Fix error copying directories.

Fix bundle for base library.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22621 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2006-03-08 14:25:55 +00:00
parent 4e1daaff84
commit 48d81791bc
3 changed files with 16 additions and 9 deletions

View file

@ -6,7 +6,8 @@
than cStringUsingEncoding:
* Source/NSCalendarDate.m: Support '%T' and '%t' in description.
* Source/NSFileManager.m: don't abort directory copy just because
we can't set attributes of destination directory.
we can't set attributes of destination directory. Don't try to
copy directories with their old owners.
* Source/NSSocketPortNameServer.m:
* Source/NSBundle.m:
* Source/NSProcessInfo.m:

View file

@ -712,8 +712,6 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
env = [[NSProcessInfo processInfo] environment];
if (env)
{
NSArray *paths;
NSMutableString *system = nil;
NSString *str;
if ((str = [env objectForKey: @"GNUSTEP_TARGET_CPU"]) != nil)
@ -734,15 +732,10 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
if ((str = [env objectForKey: @"LIBRARY_COMBO"]) != nil)
library_combo = RETAIN(str);
paths = NSSearchPathForDirectoriesInDomains(GSLibrariesDirectory,
NSSystemDomainMask, YES);
if ((paths != nil) && ([paths count] > 0))
system = RETAIN([paths objectAtIndex: 0]);
_launchDirectory = RETAIN([[NSFileManager defaultManager]
currentDirectoryPath]);
_gnustep_bundle = RETAIN([self bundleWithPath: system]);
_gnustep_bundle = RETAIN([self bundleForLibrary: @"gnustep-base"]);
#if 0
_loadingBundle = [self mainBundle];

View file

@ -950,6 +950,8 @@ static NSStringEncoding defaultEncoding;
fileType = [attrs fileType];
if ([fileType isEqualToString: NSFileTypeDirectory] == YES)
{
NSMutableDictionary *mattrs;
/* If destination directory is a descendant of source directory copying
isn't possible. */
if ([[destination stringByAppendingString: @"/"]
@ -960,6 +962,17 @@ static NSStringEncoding defaultEncoding;
[self _sendToHandler: handler willProcessPath: destination];
/*
* Don't attempt to retain ownership of copy ... we want the copy
* to be owned by the current user.
*/
mattrs = [attrs mutableCopy];
[mattrs removeObjectForKey: NSFileOwnerAccountID];
[mattrs removeObjectForKey: NSFileGroupOwnerAccountID];
[mattrs removeObjectForKey: NSFileGroupOwnerAccountName];
[mattrs setObject: NSUserName() forKey: NSFileOwnerAccountName];
attrs = AUTORELEASE(mattrs);
if ([self createDirectoryAtPath: destination attributes: attrs] == NO)
{
return [self _proceedAccordingToHandler: handler