Skip to content

Commit

Permalink
when burning Weasis customization files, merge directories
Browse files Browse the repository at this point in the history
  • Loading branch information
aglv committed Mar 29, 2018
1 parent 9f64a61 commit 9cfd232
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions Horos/Sources/BurnerWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1052,9 +1052,21 @@ - (void) prepareCDContent: (NSMutableArray*) dbObjects :(NSMutableArray*) origin
[[NSFileManager defaultManager] copyItemAtPath:[weasisPath stringByAppendingPathComponent:subpath] toPath:[burnFolder stringByAppendingPathComponent:subpath] error:NULL];

NSString *burnWeasisPath = [burnFolder stringByAppendingPathComponent:@"weasis"];
for (NSString *weasisPath in [Horos WeasisCustomizationPaths])
for (NSString* subpath in [[NSFileManager defaultManager] contentsOfDirectoryAtPath:weasisPath error:NULL])
[[NSFileManager defaultManager] copyItemAtPath:[weasisPath stringByAppendingPathComponent:subpath] toPath:[burnWeasisPath stringByAppendingPathComponent:subpath] error:NULL];
NSArray *skips = @[ @".DS_Store" ];
for (NSString *weasisPath in [[Horos WeasisCustomizationPaths] reverseObjectEnumerator]) { // reversed to mimic the WebPortal priorities
NSDirectoryEnumerator *de = [[NSFileManager defaultManager] enumeratorAtPath:weasisPath];
for (NSString *subpath in de)
if (![skips containsObject:subpath.lastPathComponent]) {
NSString *source = [weasisPath stringByAppendingPathComponent:subpath], *dest = [burnWeasisPath stringByAppendingPathComponent:subpath];;
if ([de.fileAttributes[NSFileType] isEqual:NSFileTypeDirectory]) {
[[NSFileManager defaultManager] createDirectoryAtPath:dest withIntermediateDirectories:YES attributes:nil error:NULL];
} else {
if ([[NSFileManager defaultManager] fileExistsAtPath:dest])
[[NSFileManager defaultManager] removeItemAtPath:dest error:NULL];
[[NSFileManager defaultManager] copyItemAtPath:[weasisPath stringByAppendingPathComponent:subpath] toPath:dest error:NULL];
}
}
}

// Change Label in Autorun.inf
NSStringEncoding encoding;
Expand Down

0 comments on commit 9cfd232

Please sign in to comment.