디렉토리 생성 함수 설명
directory_create
함수는 주어진 이름으로 저장 영역에 디렉토리를 생성하는 기능을 제공합니다. 이 함수는 HTML5나 GX.games에서는 작동하지 않으며, 브라우저의 로컬 스토리지에서 디렉토리를 생성하거나 제거할 수 없습니다.
문법
directory_create(dname)
인수 설명
인수 이름 | 타입 | 설명 |
---|---|---|
dname | String | 생성할 디렉토리의 이름 |
반환값
- N/A
예제
다음 코드는 지정된 디렉토리가 로컬 데이터 폴더에 존재하는지 확인하고, 존재하지 않을 경우 디렉토리를 생성합니다.
if (!directory_exists("Games")) {
directory_create("Games");
}
활용 예제
- 게임 저장 디렉토리 생성
gml if (!directory_exists("Saves")) { directory_create("Saves"); }
- 사용자 데이터 디렉토리 생성
gml if (!directory_exists("UserData")) { directory_create("UserData"); }
- 로그 파일 디렉토리 생성
gml if (!directory_exists("Logs")) { directory_create("Logs"); }
- 설정 파일 디렉토리 생성
gml if (!directory_exists("Settings")) { directory_create("Settings"); }
- 업데이트 파일 디렉토리 생성
gml if (!directory_exists("Updates")) { directory_create("Updates"); }
이와 같이 directory_create
함수를 활용하여 다양한 디렉토리를 생성할 수 있습니다.