1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
|
--- FSNode/FSNode.m
+++ FSNode/FSNode.m
@@ -1,6 +1,6 @@
/* FSNode.m
*
- * Copyright (C) 2004-2016 Free Software Foundation, Inc.
+ * Copyright (C) 2004-2018 Free Software Foundation, Inc.
*
* Author: Enrico Sersale <enrico@imago.ro>
* Date: March 2004
@@ -69,72 +69,74 @@
{
self = [super init];
- if (self) {
- NSString *lastPathComponent;
-
- fsnodeRep = [FSNodeRep sharedInstance];
- fm = [NSFileManager defaultManager];
- ws = [NSWorkspace sharedWorkspace];
-
- parent = aparent;
- ASSIGN (relativePath, rpath);
- lastPathComponent = [[relativePath lastPathComponent] retain];
- name = nil;
+ if (self)
+ {
+ NSString *lastPathComponent;
+
+ fsnodeRep = [FSNodeRep sharedInstance];
+ fm = [NSFileManager defaultManager];
+ ws = [NSWorkspace sharedWorkspace];
+
+ parent = aparent;
+ ASSIGN (relativePath, rpath);
+ lastPathComponent = [[relativePath lastPathComponent] retain];
+ name = nil;
+
+ if (parent)
+ {
+ NSString *parentPath = [parent path];
+
+ if ([parentPath isEqual: path_separator()])
+ {
+ parentPath = @"";
+ }
+ ASSIGN (path, ([NSString stringWithFormat: @"%@%@%@",
+ parentPath, path_separator(), lastPathComponent]));
+ }
+ else
+ {
+ ASSIGN (path, relativePath);
+ }
+
+ flags.readable = -1;
+ flags.writable = -1;
+ flags.executable = -1;
+ flags.deletable = -1;
+ flags.plain = -1;
+ flags.directory = -1;
+ flags.link = -1;
+ flags.socket = -1;
+ flags.charspecial = -1;
+ flags.blockspecial = -1;
+ flags.mountpoint = -1;
+ flags.application = -1;
+ flags.package = -1;
+ flags.unknown = -1;
+
+ crDate = nil;
+ modDate = nil;
+ owner = nil;
+ ownerId = nil;
+ group = nil;
+ groupId = nil;
+ filesize = 0;
+ permissions = 0;
+ fileType = nil;
+ typeDescription = nil;
+
+ application = nil;
+ attributes = [fm fileAttributesAtPath: path traverseLink: NO];
+ RETAIN (attributes);
+
+ /* we localize only directories which could be special */
+ if ([self isDirectory])
+ ASSIGN (name, NSLocalizedStringFromTableInBundle(lastPathComponent, nil, [NSBundle bundleForClass:[self class]], @""));
+ else
+ ASSIGN (name, lastPathComponent);
- if (parent) {
- NSString *parentPath = [parent path];
-
- if ([parentPath isEqual: path_separator()]) {
- parentPath = @"";
- }
- ASSIGN (path, ([NSString stringWithFormat: @"%@%@%@",
- parentPath, path_separator(), lastPathComponent]));
- } else {
- ASSIGN (path, relativePath);
+ [lastPathComponent release];
}
-
- flags.readable = -1;
- flags.writable = -1;
- flags.executable = -1;
- flags.deletable = -1;
- flags.plain = -1;
- flags.directory = -1;
- flags.link = -1;
- flags.socket = -1;
- flags.charspecial = -1;
- flags.blockspecial = -1;
- flags.mountpoint = -1;
- flags.application = -1;
- flags.package = -1;
- flags.unknown = -1;
-
- crDate = nil;
- modDate = nil;
- owner = nil;
- ownerId = nil;
- group = nil;
- groupId = nil;
-
- filesize = 0;
- permissions = 0;
-
- fileType = nil;
- typeDescription = nil;
-
- application = nil;
-
- attributes = [fm fileAttributesAtPath: path traverseLink: NO];
- RETAIN (attributes);
-
- /* we localize only directories which could be special */
- if ([self isDirectory])
- ASSIGN (name, NSLocalizedStringFromTableInBundle(lastPathComponent, nil, [NSBundle bundleForClass:[self class]], @""));
- else
- ASSIGN (name, lastPathComponent);
-
- [lastPathComponent release];
- }
-
+
return self;
}
|