Don't allow duplicate GCS folder names

This commit is contained in:
Francis Lachapelle
2018-08-30 22:09:17 -04:00
parent 18df3bafb5
commit 3bdd90e2be
7 changed files with 75 additions and 33 deletions
+10 -8
View File
@@ -614,19 +614,21 @@ static NSArray *childRecordFields = nil;
NSURL *folderLocation;
NSString *sql;
if ([[self container] hasLocalSubFolderNamed: newName])
[NSException raise: NSInvalidArgumentException
format: @"That name already exists"];
cm = [GCSChannelManager defaultChannelManager];
folderLocation
= [[GCSFolderManager defaultFolderManager] folderInfoLocation];
folderLocation = [[GCSFolderManager defaultFolderManager] folderInfoLocation];
fc = [cm acquireOpenChannelForURL: folderLocation];
if (fc)
{
#warning GDLContentStore should provide methods for renaming folders
sql
= [NSString stringWithFormat: (@"UPDATE %@ SET c_foldername = '%@'"
@" WHERE c_path = '%@'"),
[folderLocation gcsTableName],
[newName stringByReplacingString: @"'" withString: @"''"],
ocsPath];
sql = [NSString stringWithFormat: (@"UPDATE %@ SET c_foldername = '%@'"
@" WHERE c_path = '%@'"),
[folderLocation gcsTableName],
[newName stringByReplacingString: @"'" withString: @"''"],
ocsPath];
[fc evaluateExpressionX: sql];
[cm releaseChannel: fc];
// sql = [sql stringByAppendingFormat:@" WHERE %@ = '%@'",