mirror of
https://github.com/microtherion/VocalEasel.git
synced 2024-12-22 19:23:59 +00:00
Preserve version control dictionaries on save
This commit is contained in:
parent
26f135cb88
commit
b1ac753039
|
@ -24,6 +24,7 @@
|
||||||
NSString * songGroove;
|
NSString * songGroove;
|
||||||
NSNumber * songTempo;
|
NSNumber * songTempo;
|
||||||
NSString * tmpPath;
|
NSString * tmpPath;
|
||||||
|
NSFileWrapper * vcsWrapper;
|
||||||
|
|
||||||
VLSheetWindow * sheetWin;
|
VLSheetWindow * sheetWin;
|
||||||
VLLogWindow * logWin;
|
VLLogWindow * logWin;
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
pdfWin = nil;
|
pdfWin = nil;
|
||||||
logWin = nil;
|
logWin = nil;
|
||||||
tmpPath = nil;
|
tmpPath = nil;
|
||||||
|
vcsWrapper = nil;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -47,6 +48,7 @@
|
||||||
[songLyricist release];
|
[songLyricist release];
|
||||||
[songComposer release];
|
[songComposer release];
|
||||||
[songArranger release];
|
[songArranger release];
|
||||||
|
[vcsWrapper release];
|
||||||
|
|
||||||
if (tmpPath) {
|
if (tmpPath) {
|
||||||
[[NSFileManager defaultManager] removeFileAtPath:tmpPath handler:nil];
|
[[NSFileManager defaultManager] removeFileAtPath:tmpPath handler:nil];
|
||||||
|
@ -190,6 +192,30 @@
|
||||||
stringByAppendingPathExtension:extension]];
|
stringByAppendingPathExtension:extension]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL)saveToURL:(NSURL *)absoluteURL ofType:(NSString *)typeName forSaveOperation:(NSSaveOperationType)saveOperation error:(NSError **)outError
|
||||||
|
{
|
||||||
|
NSFileWrapper * preservedVCSWrapper = nil;
|
||||||
|
switch (saveOperation) {
|
||||||
|
case NSSaveToOperation:
|
||||||
|
case NSAutosaveOperation:
|
||||||
|
preservedVCSWrapper = vcsWrapper;
|
||||||
|
[preservedVCSWrapper retain];
|
||||||
|
// Fall through
|
||||||
|
case NSSaveAsOperation:
|
||||||
|
[vcsWrapper release];
|
||||||
|
vcsWrapper = nil;
|
||||||
|
// Fall through
|
||||||
|
case NSSaveOperation:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
BOOL res = [super saveToURL:absoluteURL ofType:typeName
|
||||||
|
forSaveOperation:saveOperation error:outError];
|
||||||
|
if (!vcsWrapper)
|
||||||
|
vcsWrapper = preservedVCSWrapper;
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
- (NSFileWrapper *)fileWrapperOfType:(NSString *)typeName error:(NSError **)outError
|
- (NSFileWrapper *)fileWrapperOfType:(NSString *)typeName error:(NSError **)outError
|
||||||
{
|
{
|
||||||
if ([typeName isEqual:@"VLNativeType"]) {
|
if ([typeName isEqual:@"VLNativeType"]) {
|
||||||
|
|
|
@ -300,6 +300,8 @@ const char * sSteps = "C DbD EbE F GbG AbA BbB ";
|
||||||
autorelease];
|
autorelease];
|
||||||
[wrap addRegularFileWithContents:contents
|
[wrap addRegularFileWithContents:contents
|
||||||
preferredFilename:@"Song"];
|
preferredFilename:@"Song"];
|
||||||
|
if (vcsWrapper)
|
||||||
|
[wrap addFileWrapper:vcsWrapper];
|
||||||
|
|
||||||
return wrap;
|
return wrap;
|
||||||
}
|
}
|
||||||
|
@ -456,8 +458,13 @@ int8_t sStepToPitch[] = {
|
||||||
|
|
||||||
- (BOOL)readFromXMLFileWrapper:(NSFileWrapper *)wrapper error:(NSError **)outError
|
- (BOOL)readFromXMLFileWrapper:(NSFileWrapper *)wrapper error:(NSError **)outError
|
||||||
{
|
{
|
||||||
return [self readFromXMLData: [[[wrapper fileWrappers] objectForKey:@"Song"]
|
NSDictionary * wrappers = [wrapper fileWrappers];
|
||||||
regularFileContents]
|
if ((vcsWrapper = [wrappers objectForKey:@"CVS"])
|
||||||
|
|| (vcsWrapper = [wrappers objectForKey:@".svn"])
|
||||||
|
)
|
||||||
|
[vcsWrapper retain];
|
||||||
|
return [self readFromXMLData:
|
||||||
|
[[wrappers objectForKey:@"Song"] regularFileContents]
|
||||||
error:outError];
|
error:outError];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user