이 페이지에서

StandardPaths QML Type

표준 시스템 경로에 대한 액세스를 제공합니다. 더 보기...

Import Statement: import Qt.labs.platform
Inherits:

QtObject

Status: Deprecated since 6.4

이 유형은 Qt Labs Platform 6.4부터 더 이상 사용되지 않습니다. 새로운 코드에서는 이를 사용하지 않는 것을 강력히 권장합니다.

메서드

자세한 설명

대신 QtCore::StandardPaths를 사용하십시오.

StandardPaths 싱글톤 타입은 표준 시스템 경로를 조회하는 메서드를 제공합니다. 표준 경로는 주로 FileDialog 및 FolderDialog 타입과 함께 사용할 때 유용합니다.

FileDialog {
    folder: StandardPaths.writableLocation(StandardPaths.DocumentsLocation)
}

참고: Qt.labs 모듈에 포함된 타입은 향후 버전에서 호환성이 보장되지 않습니다.

QtCore::StandardPaths, FileDialog, FolderDialog 및 QStandardPaths도 참조하십시오 .

메서드 문서

string displayName(StandardLocation type)

지정된 위치 type 에 대한 현지화된 표시 이름을 반환하거나, 관련 위치를 찾을 수 없는 경우 빈 QString 을 반환합니다.

QStandardPaths::displayName()도 참조하십시오 .

url findExecutable(string executableName, list<string> paths)

지정된 경로( paths)에서 “ executableName ”라는 실행 파일을 찾거나, “ paths ”가 비어 있는 경우 시스템 경로에서 해당 파일을 찾습니다.

대부분의 운영 체제에서 시스템 경로는 PATH 환경 변수에 의해 결정됩니다. 실행 파일을 검색할 디렉터리는 paths 인수로 설정할 수 있습니다. 사용자 지정 경로와 시스템 경로 모두에서 검색하려면 findExecutable을 두 번 호출하십시오. 한 번은 paths를 설정하고, 다른 한 번은 paths를 비워 두십시오. 호출 시 사용된 이름에 따라 동작이 달라지는 실행 파일의 경우, 동작을 그대로 유지하기 위해 심볼릭 링크는 해결되지 않습니다.

참고: Windows에서는 일반적인 실행 파일 확장자(PATHEXT 환경 변수에 정의된 것)가 자동으로 추가됩니다. 예를 들어, findExecutable("foo") 호출은 foo.exe 또는 foo.bat 이 존재할 경우 이를 찾습니다.

실행 파일의 절대 파일 경로를 반환하며, 찾을 수 없는 경우 빈 문자열을 반환합니다.

주어진 executableName 가 실행 파일을 가리키는 절대 경로인 경우, 해당 파일의 클린 경로가 반환됩니다.

QStandardPaths::findExecutable()도 참조하십시오 .

url locate(StandardLocation type, string fileName, LocateOptions options)

type 의 표준 위치에서 ‘ fileName ’이라는 이름의 파일이나 디렉터리를 찾습니다.

options 플래그를 사용하면 파일이나 디렉터리를 검색할지 여부를 지정할 수 있습니다. 기본적으로 이 플래그는 LocateFile 로 설정되어 있습니다.

찾은 첫 번째 파일 또는 디렉터리의 절대 경로를 반환하고, 그렇지 않은 경우 빈 문자열을 반환합니다.

QStandardPaths::locate()도 참조하십시오 .

list<url> locateAll(StandardLocation type, string fileName, LocateOptions options)

type 의 표준 위치에서 ‘ fileName ’라는 이름의 모든 파일 또는 디렉터리를 찾습니다.

options 플래그를 사용하면 파일이나 디렉터리를 검색할지 여부를 지정할 수 있습니다. 기본적으로 이 플래그는 LocateFile 로 설정되어 있습니다.

찾아낸 모든 파일의 목록을 반환합니다.

QStandardPaths::locateAll()도 참조하십시오 .

void setTestModeEnabled(bool testMode)

testMode 의 값이 true 인 경우, QStandardPaths 에서 특수한 “테스트 모드”가 활성화되어 쓰기 가능한 위치가 테스트 디렉터리로 변경됩니다. 이를 통해 자동 테스트가 현재 사용자의 설정 파일을 읽거나 쓰지 못하도록 방지합니다.

이는 테스트 프로그램이 파일을 쓸 수 있는 다음 위치에 영향을 미칩니다: GenericDataLocation, AppDataLocation, ConfigLocation, GenericConfigLocation, AppConfigLocation, StateLocation, GenericStateLocation, GenericCacheLocation, CacheLocation. 다른 위치는 영향을 받지 않습니다.

Unix에서는 XDG_DATA_HOME 가 ~/.qttest/share 로, XDG_CONFIG_HOME 가 ~/.qttest/config 로, XDG_STATE_HOME 가 ~/.qttest/state 로, XDG_CACHE_HOME 가 ~/.qttest/cache 로 설정됩니다.

macOS에서는 데이터가 ~/.qttest/Application Support 에, 캐시가 ~/.qttest/Cache 에, 구성 파일이 ~/.qttest/Preferences 에 저장됩니다.

Windows에서는 모든 파일이 %APPDATA% 하위의 "qttest" 디렉터리에 저장됩니다.

QStandardPaths::setTestModeEnabled()도 참조하십시오 .

list<url> standardLocations(StandardLocation type)

type 에 해당하는 파일이 포함된 모든 디렉터리를 반환합니다.

디렉터리 목록은 우선순위가 높은 순서대로 정렬되며, ` writableLocation()`를 확인할 수 있는 경우 이를 맨 앞에 배치합니다. 해당 유형에 대한 위치가 정의되어 있지 않으면 이 목록은 비어 있습니다.

QStandardPaths::standardLocations()도 참조하십시오 .

url writableLocation(StandardLocation type)

type 의 파일이 기록되어야 할 디렉터리를 반환하거나, 위치를 확인할 수 없는 경우 빈 문자열을 반환합니다.

참고: 반환된 저장위치는 존재하지 않을 수 있습니다. 즉, 시스템이나 사용자가 해당 위치를 생성해야 할 수도 있습니다.

QStandardPaths::writableLocation()도 참조하십시오 .

© 2026 The Qt Company Ltd. 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.