fix(core): update
This commit is contained in:
		| @@ -3,6 +3,6 @@ | ||||
|  */ | ||||
| export const commitinfo = { | ||||
|   name: '@pushrocks/smartfile', | ||||
|   version: '10.0.25', | ||||
|   version: '10.0.26', | ||||
|   description: 'offers smart ways to work with files in nodejs' | ||||
| } | ||||
|   | ||||
| @@ -47,7 +47,7 @@ export class VirtualDirectory { | ||||
|   } | ||||
|  | ||||
|   public async saveToDisk(dirArg: string) { | ||||
|     console.log(`writing VirtualDirectory with ${this.smartfileArray.length} to directory: | ||||
|     console.log(`writing VirtualDirectory with ${this.smartfileArray.length} files to directory: | ||||
|     --> ${dirArg}`); | ||||
|     for (const smartfileArg of this.smartfileArray) { | ||||
|       const filePath = await smartfileArg.writeToDir(dirArg); | ||||
| @@ -56,6 +56,22 @@ export class VirtualDirectory { | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   // TODO implement root shifting to get subdirectories as new virtual directories | ||||
|   // TODO implement root shifting to combine VirtualDirecotries in a parent virtual directory | ||||
|   public async shiftToSubdirectory(subDir: string): Promise<VirtualDirectory> { | ||||
|     const newVirtualDir = new VirtualDirectory(); | ||||
|     for (const file of this.smartfileArray) { | ||||
|       if (file.path.startsWith(subDir)) { | ||||
|         const adjustedFilePath = plugins.path.relative(subDir, file.path); | ||||
|         file.path = adjustedFilePath; | ||||
|         newVirtualDir.addSmartfiles([file]); | ||||
|       } | ||||
|     } | ||||
|     return newVirtualDir; | ||||
|   } | ||||
|  | ||||
|   public async addVirtualDirectory(virtualDir: VirtualDirectory, newRoot: string): Promise<void> { | ||||
|     for (const file of virtualDir.smartfileArray) { | ||||
|       file.path = plugins.path.join(newRoot, file.path); | ||||
|     } | ||||
|     this.addSmartfiles(virtualDir.smartfileArray); | ||||
|   } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user