File tree 1 file changed +18
-0
lines changed
packages/angular_devkit/core/src/virtual-fs/host
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ import {
33
33
Stats ,
34
34
} from './interface' ;
35
35
36
+
36
37
export interface SimpleMemoryHostStats {
37
38
readonly content : FileBuffer | null ;
38
39
}
@@ -210,6 +211,23 @@ export class SimpleMemoryHost implements Host<{}> {
210
211
} else {
211
212
const content = this . _cache . get ( from ) ;
212
213
if ( content ) {
214
+ const fragments = split ( to ) ;
215
+ const newDirectories = [ ] ;
216
+ let curr : Path = normalize ( '/' ) ;
217
+ for ( const fr of fragments ) {
218
+ curr = join ( curr , fr ) ;
219
+ const maybeStats = this . _cache . get ( fr ) ;
220
+ if ( maybeStats ) {
221
+ if ( maybeStats . isFile ( ) ) {
222
+ throw new PathIsFileException ( curr ) ;
223
+ }
224
+ } else {
225
+ newDirectories . push ( curr ) ;
226
+ }
227
+ }
228
+ for ( const newDirectory of newDirectories ) {
229
+ this . _cache . set ( newDirectory , this . _newDirStats ( ) ) ;
230
+ }
213
231
this . _cache . delete ( from ) ;
214
232
this . _cache . set ( to , content ) ;
215
233
}
You can’t perform that action at this time.
0 commit comments