MCPcopy Create free account
hub / github.com/MCSManager/MCSManager / rename

Method rename

daemon/src/service/system_file.ts:304–310  ·  view source on GitHub ↗
(target: string, newName: string)

Source from the content-addressed store, hash-verified

302 }
303
304 rename(target: string, newName: string) {
305 if (!this.check(target)) throw new Error(ERROR_MSG_01);
306 if (!this.checkPath(newName)) throw new Error(ERROR_MSG_01);
307 const targetPath = this.toAbsolutePath(target);
308 const newPath = this.toAbsolutePath(newName);
309 fs.renameSync(targetPath, newPath);
310 }
311
312 public static checkFileName(fileName?: string): boolean {
313 if (!fileName) return false;

Callers 1

toggleModMethod · 0.80

Calls 3

checkMethod · 0.95
checkPathMethod · 0.95
toAbsolutePathMethod · 0.95

Tested by

no test coverage detected