Author: rfm
Date: Mon Feb 29 08:44:12 2016
New Revision: 39421
URL: http://svn.gna.org/viewcvs/gnustep?rev=39421&view=rev
Log:
fix for copying subdirectories
Modified:
libs/base/trunk/ChangeLog
libs/base/trunk/Source/NSFileManager.m
Modified: libs/base/trunk/ChangeLog
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/ChangeLog?rev=39421&r1=39420&r2=39421&view=diff
==============================================================================
--- libs/base/trunk/ChangeLog (original)
+++ libs/base/trunk/ChangeLog Mon Feb 29 08:44:12 2016
@@ -1,3 +1,8 @@
+2016-02-29 Richard Frith-Macdonald <[email protected]>
+
+ * Based on testplant patch, fix bug with ownership when copying
+ subdirectories.
+
2016-02-26 Niels Grewe <[email protected]>
* Headers/Foundation/NSObjCRuntime.h: Declare the FOUNDATION_EXPORT
Modified: libs/base/trunk/Source/NSFileManager.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/NSFileManager.m?rev=39421&r1=39420&r2=39421&view=diff
==============================================================================
--- libs/base/trunk/Source/NSFileManager.m (original)
+++ libs/base/trunk/Source/NSFileManager.m Mon Feb 29 08:44:12 2016
@@ -693,19 +693,21 @@
}
}
-- (NSArray*) contentsOfDirectoryAtURL:(NSURL*)url
- includingPropertiesForKeys:(NSArray*)keys
- options:(NSDirectoryEnumerationOptions)mask
- error:(NSError **)error
-{
- NSArray *result;
+- (NSArray*) contentsOfDirectoryAtURL: (NSURL*)url
+ includingPropertiesForKeys: (NSArray*)keys
+ options: (NSDirectoryEnumerationOptions)mask
+ error: (NSError **)error
+{
+ NSArray *result;
NSDirectoryEnumerator *direnum;
- NSString *path;
+ NSString *path;
DESTROY(_lastError);
- if (![[url scheme] isEqualToString:@"file"])
- return nil;
+ if (![[url scheme] isEqualToString: @"file"])
+ {
+ return nil;
+ }
path = [url path];
direnum = [[NSDirectoryEnumerator alloc]
@@ -719,9 +721,9 @@
result = nil;
if (nil != direnum)
{
- IMP nxtImp;
- NSMutableArray *urlArray;
- NSString *tempPath;
+ IMP nxtImp;
+ NSMutableArray *urlArray;
+ NSString *tempPath;
nxtImp = [direnum methodForSelector: @selector(nextObject)];
@@ -729,20 +731,25 @@
urlArray = [NSMutableArray arrayWithCapacity:128];
while ((tempPath = (*nxtImp)(direnum, @selector(nextObject))) != nil)
{
- NSURL *tempURL;
- NSString *lastComponent;
+ NSURL *tempURL;
+ NSString *lastComponent;
- tempURL = [NSURL fileURLWithPath:tempPath];
+ tempURL = [NSURL fileURLWithPath: tempPath];
lastComponent = [tempPath lastPathComponent];
/* we purge files beginning with . */
- if (!((mask & NSDirectoryEnumerationSkipsHiddenFiles) &&
[lastComponent hasPrefix:@"."]))
- [urlArray addObject:tempURL];
+ if (!((mask & NSDirectoryEnumerationSkipsHiddenFiles)
+ && [lastComponent hasPrefix:@"."]))
+ {
+ [urlArray addObject: tempURL];
+ }
}
RELEASE(direnum);
if ([urlArray count] > 0)
- result = [NSArray arrayWithArray:urlArray];
+ {
+ result = [NSArray arrayWithArray: urlArray];
+ }
}
if (error != NULL)
@@ -2872,10 +2879,18 @@
if ([fileType isEqual: NSFileTypeDirectory])
{
- BOOL dirOK;
-
+ NSMutableDictionary *newAttributes;
+ BOOL dirOK;
+
+ newAttributes = [attributes mutableCopy];
+ [newAttributes removeObjectForKey: NSFileOwnerAccountID];
+ [newAttributes removeObjectForKey: NSFileGroupOwnerAccountID];
+ [newAttributes removeObjectForKey: NSFileGroupOwnerAccountName];
+ [newAttributes setObject: NSUserName()
+ forKey: NSFileOwnerAccountName];
dirOK = [self createDirectoryAtPath: destinationFile
- attributes: attributes];
+ attributes: newAttributes];
+ RELEASE(newAttributes);
if (dirOK == NO)
{
if (![self _proceedAccordingToHandler: handler
@@ -2900,8 +2915,8 @@
{
[enumerator skipDescendents];
if (![self _copyPath: sourceFile
- toPath: destinationFile
- handler: handler])
+ toPath: destinationFile
+ handler: handler])
{
RELEASE(pool);
return NO;
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs