Utils::FileInProjectFinder Class
class Utils::FileInProjectFinderFileInProjectFinder 클래스는 주어진 파일 URL에 대해 프로젝트 디렉터리 내에서 원본 파일을 찾는 데 사용되는 헬퍼 클래스입니다. 더 보기...
| Header: | #include <FileInProjectFinder> |
공개 함수
| Utils::FilePaths | findFile(const QUrl &fileUrl, bool *success = nullptr) const |
상세 설명
빌드 및 배포 과정에서 파일이 복사되는 경우가 많습니다. findFile()는 주어진 파일 경로에 대해 프로젝트 디렉터리에서 기존 파일을 검색합니다.
예를 들어, 다음 파일 경로는 모두 $PROJECTDIR/qml/app/main.qml로 매핑되어야 합니다.
- C:/app-build-desktop/qml/app/main.qml (섀도 빌드 디렉터리)
- /Users/x/app-build-desktop/App.app/Contents/Resources/qml/App/main.qml (macOS의 폴더)
멤버 함수 문서
Utils::FilePaths FileInProjectFinder::findFile(const QUrl &fileUrl, bool *success = nullptr) const
프로젝트 디렉터리 내의 파일 URL fileUrl 과 가장 잘 일치하는 항목을 반환합니다.
이 함수는 먼저 프로젝트 디렉터리 내에 해당 파일이 존재하는지 확인합니다. 존재하지 않을 경우, 경로의 맨 앞 디렉터리를 제거한 후, 이제 더 짧아진 경로에 파일이 있는지 확인하는 과정을 반복합니다. 둘째, 지정된 sysroot 폴더에서 파일을 찾으려고 시도합니다. 셋째, 프로젝트 파일 목록을 순회하며 파일 이름이 일치하는 파일을 검색합니다.
모든 시도가 실패하면, 이 함수는 파일 URL의 원래 경로를 반환합니다. 프로젝트 내에서 일치하는 항목을 찾지 못했음을 나타내기 위해, success 는 false로 설정됩니다.
Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.