mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-19 23:33:13 +09:00
Add findUnusedName to file_ops.js
Add function to find an unused name in a directory to lib/file_ops and use it for finding an unused instance directory.
This commit is contained in:
1 parent
544d8deb81
commit
0066a06107
3 files changed
+75
-7
No files matched your search
@@ -1102,13 +1102,8 @@ class Slave extends libLink.Link {
|
||||
throw new Error(`Instance name ${err.message}`);
|
||||
}
|
||||
|
||||
// For now add dashes until an unused directory name is found
|
||||
let dir = path.join(this.config.get("slave.instances_directory"), name);
|
||||
while (await fs.pathExists(dir)) {
|
||||
dir += "-";
|
||||
}
|
||||
|
||||
return dir;
|
||||
let instancesDir = this.config.get("slave.instances_directory");
|
||||
return path.join(instancesDir, await libFileOps.findUnusedName(instancesDir, name));
|
||||
}
|
||||
|
||||
async forwardRequestToInstance(message, request) {
|
||||
|
||||
Reference in new issue
Block a user