Skip to content

Commit

Permalink
splewis#225: Create subdirectories for bot setup files
Browse files Browse the repository at this point in the history
If subdirectories do not exist, create them
  • Loading branch information
Cyberschorsch authored Feb 14, 2022
1 parent 4d5a145 commit 1ea3bfa
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scripting/practicemode/bots.sp
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,12 @@ public Action Command_SaveBots(int client, int args) {
}
// Custom bot placements are in a subdirectory.
BuildPath(Path_SM, path, sizeof(path), "data/practicemode/bots/%s/%s.cfg", mapName, filename);
char dir[PLATFORM_MAX_PATH];
BuildPath(Path_SM, dir, sizeof(dir), "data/practicemode/bots/%s", mapName);
if (!DirExists(dir)) {
if (!CreateDirectory(dir, 511))
LogError("Failed to create directory %s", dir);
}
}
// Use the default legacy path if no argument has been provided to the command.
else {
Expand Down

0 comments on commit 1ea3bfa

Please sign in to comment.