rb-fsevent 0.9.0.pre3 → 0.9.0.pre4
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/fsevent_watch +0 -0
- data/ext/fsevent_watch/Info.plist +10 -0
- data/ext/fsevent_watch/fsevent_watch.xcodeproj/project.pbxproj +41 -3
- data/ext/fsevent_watch/fsevent_watch/TSICTString.c +12 -12
- data/ext/fsevent_watch/fsevent_watch/cli.c +1 -1
- data/ext/fsevent_watch/fsevent_watch/cli.h +7 -1
- data/ext/fsevent_watch/fsevent_watch/main.c +102 -79
- data/ext/rb-fsevent.xcconfig +13 -0
- data/lib/rb-fsevent/version.rb +1 -1
- metadata +13 -25
- data/ext/fsevent_watch/build/fsevent_watch.build/Release/fsevent_watch.build/Objects-normal/x86_64/TSICTString.o +0 -0
- data/ext/fsevent_watch/build/fsevent_watch.build/Release/fsevent_watch.build/Objects-normal/x86_64/cli.o +0 -0
- data/ext/fsevent_watch/build/fsevent_watch.build/Release/fsevent_watch.build/Objects-normal/x86_64/compat.o +0 -0
- data/ext/fsevent_watch/build/fsevent_watch.build/Release/fsevent_watch.build/Objects-normal/x86_64/fsevent_watch.LinkFileList +0 -4
- data/ext/fsevent_watch/build/fsevent_watch.build/Release/fsevent_watch.build/Objects-normal/x86_64/main.o +0 -0
- data/ext/fsevent_watch/build/fsevent_watch.build/Release/fsevent_watch.build/StaticAnalyzer/normal/x86_64/TSICTString.plist +0 -12
- data/ext/fsevent_watch/build/fsevent_watch.build/Release/fsevent_watch.build/StaticAnalyzer/normal/x86_64/cli.plist +0 -12
- data/ext/fsevent_watch/build/fsevent_watch.build/Release/fsevent_watch.build/StaticAnalyzer/normal/x86_64/compat.plist +0 -12
- data/ext/fsevent_watch/build/fsevent_watch.build/Release/fsevent_watch.build/StaticAnalyzer/normal/x86_64/main.plist +0 -12
- data/ext/fsevent_watch/build/fsevent_watch.build/Release/fsevent_watch.build/build-state.dat +0 -303
- data/ext/fsevent_watch/build/fsevent_watch.build/Release/fsevent_watch.build/build-state~.dat +0 -248
- data/ext/fsevent_watch/build/fsevent_watch.build/Release/fsevent_watch.build/fsevent_watch.dep +0 -10
- data/ext/fsevent_watch/build/fsevent_watch.build/Release/fsevent_watch.build/fsevent_watch.hmap +0 -0
- data/ext/fsevent_watch/build/fsevent_watch.build/Release/fsevent_watch.build/fsevent_watch~.dep +0 -9
data/bin/fsevent_watch
ADDED
Binary file
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>CFBundleIdentifier</key>
|
6
|
+
<string>com.teaspoonofinsanity.fsevent_watch</string>
|
7
|
+
<key>CFBundleName</key>
|
8
|
+
<string>fsevent_watch</string>
|
9
|
+
</dict>
|
10
|
+
</plist>
|
@@ -22,6 +22,7 @@
|
|
22
22
|
6A57F6FF13F5E614000BE6A9 /* fsevent_watch */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = fsevent_watch; sourceTree = BUILT_PRODUCTS_DIR; };
|
23
23
|
6A57F70313F5E614000BE6A9 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = System/Library/Frameworks/CoreServices.framework; sourceTree = SDKROOT; };
|
24
24
|
6A57F70613F5E614000BE6A9 /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; };
|
25
|
+
6A68C5E31440CBDF0040623D /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = SOURCE_ROOT; };
|
25
26
|
6A81FCE7143429DE00F83EDD /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
|
26
27
|
6A81FCEA14342A6300F83EDD /* TSICTString.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = TSICTString.c; sourceTree = "<group>"; };
|
27
28
|
6A81FCEB14342A6300F83EDD /* TSICTString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSICTString.h; sourceTree = "<group>"; };
|
@@ -45,6 +46,7 @@
|
|
45
46
|
6A57F6F413F5E614000BE6A9 = {
|
46
47
|
isa = PBXGroup;
|
47
48
|
children = (
|
49
|
+
6A68C5E31440CBDF0040623D /* Info.plist */,
|
48
50
|
6A57F70513F5E614000BE6A9 /* fsevent_watch */,
|
49
51
|
6A57F70213F5E614000BE6A9 /* Frameworks */,
|
50
52
|
6A57F70013F5E614000BE6A9 /* Products */,
|
@@ -150,7 +152,9 @@
|
|
150
152
|
buildSettings = {
|
151
153
|
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
|
152
154
|
CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES;
|
155
|
+
CODE_SIGN_IDENTITY = "Mac Developer";
|
153
156
|
COPY_PHASE_STRIP = NO;
|
157
|
+
CURRENT_PROJECT_VERSION = 0.1.0;
|
154
158
|
DEAD_CODE_STRIPPING = YES;
|
155
159
|
DEBUG_INFORMATION_FORMAT = dwarf;
|
156
160
|
GCC_C_LANGUAGE_STANDARD = gnu99;
|
@@ -165,6 +169,7 @@
|
|
165
169
|
GCC_INLINES_ARE_PRIVATE_EXTERN = YES;
|
166
170
|
GCC_OPTIMIZATION_LEVEL = 0;
|
167
171
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
172
|
+
"PROJECT_VERSION=\"$(CURRENT_PROJECT_VERSION)\"",
|
168
173
|
"DEBUG=1",
|
169
174
|
"$(inherited)",
|
170
175
|
);
|
@@ -186,7 +191,7 @@
|
|
186
191
|
LD_NO_PIE = NO;
|
187
192
|
LLVM_LTO = NO;
|
188
193
|
"LLVM_LTO[arch=x86_64]" = YES;
|
189
|
-
MACOSX_DEPLOYMENT_TARGET = 10.
|
194
|
+
MACOSX_DEPLOYMENT_TARGET = 10.6;
|
190
195
|
ONLY_ACTIVE_ARCH = NO;
|
191
196
|
PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
|
192
197
|
PRESERVE_DEAD_CODE_INITS_AND_TERMS = YES;
|
@@ -194,7 +199,18 @@
|
|
194
199
|
SDKROOT = "";
|
195
200
|
STRIP_INSTALLED_PRODUCT = NO;
|
196
201
|
VALID_ARCHS = "i386 x86_64";
|
197
|
-
WARNING_CFLAGS =
|
202
|
+
WARNING_CFLAGS = (
|
203
|
+
"-pedantic",
|
204
|
+
"-Wall",
|
205
|
+
"-Wextra",
|
206
|
+
"-Wpointer-arith",
|
207
|
+
"-Wformat=2",
|
208
|
+
"-Wfloat-equal",
|
209
|
+
"-Wstrict-overflow=4",
|
210
|
+
"-Wbad-function-cast",
|
211
|
+
"-Winline",
|
212
|
+
"-Wconversion",
|
213
|
+
);
|
198
214
|
};
|
199
215
|
name = Debug;
|
200
216
|
};
|
@@ -203,7 +219,9 @@
|
|
203
219
|
buildSettings = {
|
204
220
|
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
|
205
221
|
CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES;
|
222
|
+
CODE_SIGN_IDENTITY = "Mac Developer";
|
206
223
|
COPY_PHASE_STRIP = YES;
|
224
|
+
CURRENT_PROJECT_VERSION = 0.1.0;
|
207
225
|
DEAD_CODE_STRIPPING = YES;
|
208
226
|
DEBUG_INFORMATION_FORMAT = dwarf;
|
209
227
|
GCC_C_LANGUAGE_STANDARD = gnu99;
|
@@ -215,6 +233,10 @@
|
|
215
233
|
GCC_FAST_OBJC_DISPATCH = YES;
|
216
234
|
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
217
235
|
GCC_INLINES_ARE_PRIVATE_EXTERN = YES;
|
236
|
+
GCC_PREPROCESSOR_DEFINITIONS = (
|
237
|
+
"PROJECT_VERSION=\"$(CURRENT_PROJECT_VERSION)\"",
|
238
|
+
"NDEBUG=1",
|
239
|
+
);
|
218
240
|
GCC_REUSE_STRINGS = YES;
|
219
241
|
GCC_STRICT_ALIASING = NO;
|
220
242
|
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
|
@@ -233,7 +255,7 @@
|
|
233
255
|
LD_NO_PIE = NO;
|
234
256
|
LLVM_LTO = NO;
|
235
257
|
"LLVM_LTO[arch=x86_64]" = YES;
|
236
|
-
MACOSX_DEPLOYMENT_TARGET = 10.
|
258
|
+
MACOSX_DEPLOYMENT_TARGET = 10.6;
|
237
259
|
ONLY_ACTIVE_ARCH = NO;
|
238
260
|
PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
|
239
261
|
PRESERVE_DEAD_CODE_INITS_AND_TERMS = YES;
|
@@ -246,7 +268,15 @@
|
|
246
268
|
6A57F70D13F5E614000BE6A9 /* Debug */ = {
|
247
269
|
isa = XCBuildConfiguration;
|
248
270
|
buildSettings = {
|
271
|
+
INFOPLIST_FILE = Info.plist;
|
272
|
+
INFOPLIST_PREPROCESS = YES;
|
249
273
|
MACH_O_TYPE = mh_execute;
|
274
|
+
OTHER_LDFLAGS = (
|
275
|
+
"-sectcreate",
|
276
|
+
__TEXT,
|
277
|
+
__info_plist,
|
278
|
+
Info.plist,
|
279
|
+
);
|
250
280
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
251
281
|
};
|
252
282
|
name = Debug;
|
@@ -254,7 +284,15 @@
|
|
254
284
|
6A57F70E13F5E614000BE6A9 /* Release */ = {
|
255
285
|
isa = XCBuildConfiguration;
|
256
286
|
buildSettings = {
|
287
|
+
INFOPLIST_FILE = Info.plist;
|
288
|
+
INFOPLIST_PREPROCESS = YES;
|
257
289
|
MACH_O_TYPE = mh_execute;
|
290
|
+
OTHER_LDFLAGS = (
|
291
|
+
"-sectcreate",
|
292
|
+
__TEXT,
|
293
|
+
__info_plist,
|
294
|
+
Info.plist,
|
295
|
+
);
|
258
296
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
259
297
|
};
|
260
298
|
name = Release;
|
@@ -16,13 +16,13 @@ TSITStringFormat TSITStringDefaultFormat = kTSITStringFormatTNetstring;
|
|
16
16
|
|
17
17
|
static const CFRange BeginningRange = {0,0};
|
18
18
|
|
19
|
-
static CFTypeID kCFDataTypeID = -
|
20
|
-
static CFTypeID kCFStringTypeID = -
|
21
|
-
static CFTypeID kCFNumberTypeID = -
|
22
|
-
static CFTypeID kCFBooleanTypeID = -
|
23
|
-
static CFTypeID kCFNullTypeID = -
|
24
|
-
static CFTypeID kCFArrayTypeID = -
|
25
|
-
static CFTypeID kCFDictionaryTypeID = -
|
19
|
+
static CFTypeID kCFDataTypeID = -1UL;
|
20
|
+
static CFTypeID kCFStringTypeID = -1UL;
|
21
|
+
static CFTypeID kCFNumberTypeID = -1UL;
|
22
|
+
static CFTypeID kCFBooleanTypeID = -1UL;
|
23
|
+
static CFTypeID kCFNullTypeID = -1UL;
|
24
|
+
static CFTypeID kCFArrayTypeID = -1UL;
|
25
|
+
static CFTypeID kCFDictionaryTypeID = -1UL;
|
26
26
|
|
27
27
|
|
28
28
|
__attribute__((constructor)) void Init_TSICTString(void)
|
@@ -88,14 +88,14 @@ static inline CFDataRef TSICTStringCreateDataFromIntermediateRepresentation(TStr
|
|
88
88
|
UInt8* bufferBytes = CFDataGetMutableBytePtr(buffer);
|
89
89
|
|
90
90
|
size_t prefixLength = strlen(rep->length) + 1;
|
91
|
-
CFDataReplaceBytes(buffer, BeginningRange, (const UInt8*)rep->length, prefixLength);
|
91
|
+
CFDataReplaceBytes(buffer, BeginningRange, (const UInt8*)rep->length, (CFIndex)prefixLength);
|
92
92
|
|
93
93
|
if (rep->format == kTSITStringFormatTNetstring) {
|
94
|
-
const UInt8 ftag = TNetstringTypes[rep->type];
|
94
|
+
const UInt8 ftag = (UInt8)TNetstringTypes[rep->type];
|
95
95
|
CFDataAppendBytes(buffer, &ftag, 1);
|
96
96
|
bufferBytes[(prefixLength - 1)] = TNetstringSeparator;
|
97
97
|
} else if (rep->format == kTSITStringFormatOTNetstring) {
|
98
|
-
const UInt8 ftag = OTNetstringTypes[rep->type];
|
98
|
+
const UInt8 ftag = (UInt8)OTNetstringTypes[rep->type];
|
99
99
|
bufferBytes[(prefixLength - 1)] = ftag;
|
100
100
|
}
|
101
101
|
|
@@ -315,13 +315,13 @@ TStringIRep* TSICTStringCreateWithNumberAndFormat(CFNumberRef number, TSITString
|
|
315
315
|
}
|
316
316
|
memmove(p, e, strlen(e)+1);
|
317
317
|
|
318
|
-
data = CFDataCreate(kCFAllocatorDefault, (UInt8*)buf, strlen(buf));
|
318
|
+
data = CFDataCreate(kCFAllocatorDefault, (UInt8*)buf, (CFIndex)strlen(buf));
|
319
319
|
} else {
|
320
320
|
char buf[32];
|
321
321
|
SInt64 value;
|
322
322
|
CFNumberGetValue(number, numType, &value);
|
323
323
|
sprintf(buf, "%lli", value);
|
324
|
-
data = CFDataCreate(kCFAllocatorDefault, (UInt8*)buf, strlen(buf));
|
324
|
+
data = CFDataCreate(kCFAllocatorDefault, (UInt8*)buf, (CFIndex)strlen(buf));
|
325
325
|
}
|
326
326
|
|
327
327
|
TStringIRep* rep = TSICTStringCreateWithDataOfTypeAndFormat(data, tag, format);
|
@@ -146,7 +146,7 @@ int cli_parser (int argc, const char** argv, struct cli_info* args_info)
|
|
146
146
|
|
147
147
|
if (optind < argc) {
|
148
148
|
int i = 0;
|
149
|
-
args_info->inputs_num = argc - optind;
|
149
|
+
args_info->inputs_num = (unsigned int)(argc - optind);
|
150
150
|
args_info->inputs =
|
151
151
|
(char**)(malloc ((args_info->inputs_num)*sizeof(char*)));
|
152
152
|
while (optind < argc)
|
@@ -5,8 +5,14 @@
|
|
5
5
|
#define CLI_NAME "fsevent_watch"
|
6
6
|
#endif /* CLI_NAME */
|
7
7
|
|
8
|
+
#ifndef PROJECT_VERSION
|
9
|
+
#error "PROJECT_VERSION not set"
|
10
|
+
#endif /* PROJECT_VERSION */
|
11
|
+
|
8
12
|
#ifndef CLI_VERSION
|
9
|
-
#define
|
13
|
+
#define _str(s) #s
|
14
|
+
#define _xstr(s) _str(s)
|
15
|
+
#define CLI_VERSION _xstr(PROJECT_VERSION)
|
10
16
|
#endif /* CLI_VERSION */
|
11
17
|
|
12
18
|
#include "common.h"
|
@@ -27,7 +27,6 @@ static struct {
|
|
27
27
|
|
28
28
|
// Prototypes
|
29
29
|
static void append_path(const char* path);
|
30
|
-
static void append_path2(const char* path);
|
31
30
|
static inline void parse_cli_settings(int argc, const char* argv[]);
|
32
31
|
static void callback(FSEventStreamRef streamRef,
|
33
32
|
void* clientCallBackInfo,
|
@@ -36,23 +35,114 @@ static void callback(FSEventStreamRef streamRef,
|
|
36
35
|
const FSEventStreamEventFlags eventFlags[],
|
37
36
|
const FSEventStreamEventId eventIds[]);
|
38
37
|
|
38
|
+
|
39
39
|
// Resolve a path and append it to the CLI settings structure
|
40
40
|
// The FSEvents API will, internally, resolve paths using a similar scheme.
|
41
41
|
// Performing this ahead of time makes things less confusing, IMHO.
|
42
|
-
|
42
|
+
static void append_path(const char* path)
|
43
43
|
{
|
44
44
|
#ifdef DEBUG
|
45
45
|
fprintf(stderr, "\n");
|
46
46
|
fprintf(stderr, "append_path called for: %s\n", path);
|
47
47
|
#endif
|
48
48
|
|
49
|
+
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
|
50
|
+
|
51
|
+
#ifdef DEBUG
|
52
|
+
fprintf(stderr, "compiled against 10.6+, using CFURLCreateFileReferenceURL\n");
|
53
|
+
#endif
|
54
|
+
|
55
|
+
CFURLRef url = CFURLCreateFromFileSystemRepresentation(NULL, (const UInt8*)path, (CFIndex)strlen(path), false);
|
56
|
+
CFURLRef placeholder = CFURLCopyAbsoluteURL(url);
|
57
|
+
CFRelease(url);
|
58
|
+
|
59
|
+
CFMutableArrayRef imaginary = NULL;
|
60
|
+
|
61
|
+
// if we don't have an existing url, spin until we get to a parent that
|
62
|
+
// does exist, saving any imaginary components for appending back later
|
63
|
+
while(!CFURLResourceIsReachable(placeholder, NULL)) {
|
64
|
+
#ifdef DEBUG
|
65
|
+
fprintf(stderr, "path does not exist\n");
|
66
|
+
#endif
|
67
|
+
|
68
|
+
CFStringRef child;
|
69
|
+
|
70
|
+
if (imaginary == NULL) {
|
71
|
+
imaginary = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
|
72
|
+
}
|
73
|
+
|
74
|
+
child = CFURLCopyLastPathComponent(placeholder);
|
75
|
+
CFArrayInsertValueAtIndex(imaginary, 0, child);
|
76
|
+
CFRelease(child);
|
77
|
+
|
78
|
+
url = CFURLCreateCopyDeletingLastPathComponent(NULL, placeholder);
|
79
|
+
CFRelease(placeholder);
|
80
|
+
placeholder = url;
|
81
|
+
|
82
|
+
#ifdef DEBUG
|
83
|
+
fprintf(stderr, "parent: ");
|
84
|
+
CFShow(placeholder);
|
85
|
+
#endif
|
86
|
+
}
|
87
|
+
|
88
|
+
#ifdef DEBUG
|
89
|
+
fprintf(stderr, "path exists\n");
|
90
|
+
#endif
|
91
|
+
|
92
|
+
// realpath() doesn't always return the correct case for a path, so this
|
93
|
+
// is a funky workaround that converts a path into a (volId/inodeId) pair
|
94
|
+
// and asks what the path should be for that. since it looks at the actual
|
95
|
+
// inode instead of returning the same case passed in like realpath()
|
96
|
+
// appears to do for HFS+, it should always be correct.
|
97
|
+
url = CFURLCreateFileReferenceURL(NULL, placeholder, NULL);
|
98
|
+
CFRelease(placeholder);
|
99
|
+
placeholder = CFURLCreateFilePathURL(NULL, url, NULL);
|
100
|
+
CFRelease(url);
|
101
|
+
|
102
|
+
#ifdef DEBUG
|
103
|
+
fprintf(stderr, "path resolved to: ");
|
104
|
+
CFShow(placeholder);
|
105
|
+
#endif
|
106
|
+
|
107
|
+
// if we stripped off any imaginary path components, append them back on
|
108
|
+
if (imaginary != NULL) {
|
109
|
+
CFIndex count = CFArrayGetCount(imaginary);
|
110
|
+
for (CFIndex i = 0; i<count; i++) {
|
111
|
+
CFStringRef component = CFArrayGetValueAtIndex(imaginary, i);
|
112
|
+
#ifdef DEBUG
|
113
|
+
fprintf(stderr, "appending component: ");
|
114
|
+
CFShow(component);
|
115
|
+
#endif
|
116
|
+
url = CFURLCreateCopyAppendingPathComponent(NULL, placeholder, component, false);
|
117
|
+
CFRelease(placeholder);
|
118
|
+
placeholder = url;
|
119
|
+
}
|
120
|
+
CFRelease(imaginary);
|
121
|
+
}
|
122
|
+
|
123
|
+
#ifdef DEBUG
|
124
|
+
fprintf(stderr, "result: ");
|
125
|
+
CFShow(placeholder);
|
126
|
+
#endif
|
127
|
+
|
128
|
+
CFStringRef cfPath = CFURLCopyFileSystemPath(placeholder, kCFURLPOSIXPathStyle);
|
129
|
+
CFArrayAppendValue(config.paths, cfPath);
|
130
|
+
CFRelease(cfPath);
|
131
|
+
CFRelease(placeholder);
|
132
|
+
|
133
|
+
#else
|
134
|
+
|
135
|
+
#ifdef DEBUG
|
136
|
+
fprintf(stderr, "compiled against 10.5, using realpath()\n");
|
137
|
+
#endif
|
138
|
+
|
49
139
|
char fullPath[PATH_MAX + 1];
|
50
|
-
|
140
|
+
|
51
141
|
if (realpath(path, fullPath) == NULL) {
|
52
142
|
#ifdef DEBUG
|
53
143
|
fprintf(stderr, " realpath not directly resolvable from path\n");
|
54
144
|
#endif
|
55
|
-
|
145
|
+
|
56
146
|
if (path[0] != '/') {
|
57
147
|
#ifdef DEBUG
|
58
148
|
fprintf(stderr, " passed path is not absolute\n");
|
@@ -72,86 +162,19 @@ __attribute__((unused)) static void append_path(const char* path)
|
|
72
162
|
strlcpy(fullPath, path, sizeof(fullPath));
|
73
163
|
}
|
74
164
|
}
|
75
|
-
|
165
|
+
|
76
166
|
#ifdef DEBUG
|
77
167
|
fprintf(stderr, " resolved path to: %s\n", fullPath);
|
78
168
|
fprintf(stderr, "\n");
|
79
169
|
#endif
|
80
|
-
|
170
|
+
|
81
171
|
CFStringRef pathRef = CFStringCreateWithCString(kCFAllocatorDefault,
|
82
|
-
|
83
|
-
|
172
|
+
fullPath,
|
173
|
+
kCFStringEncodingUTF8);
|
84
174
|
CFArrayAppendValue(config.paths, pathRef);
|
85
175
|
CFRelease(pathRef);
|
86
|
-
|
87
|
-
|
88
|
-
// straight from the rear
|
89
|
-
static void append_path2(const char* path)
|
90
|
-
{
|
91
|
-
#ifdef DEBUG
|
92
|
-
char fullPath[PATH_MAX + 1];
|
93
|
-
|
94
|
-
fprintf(stderr, "\n");
|
95
|
-
fprintf(stderr, "append_path2 called for: %s\n", path);
|
96
|
-
#endif
|
97
|
-
|
98
|
-
OSStatus err = noErr;
|
99
|
-
FSRef fsref;
|
100
|
-
AliasHandle itemAlias = NULL;
|
101
|
-
CFStringRef pathString = NULL;
|
102
|
-
|
103
|
-
err = FSPathMakeRefWithOptions((const UInt8*)path, kFSPathMakeRefDefaultOptions, &fsref, NULL);
|
104
|
-
|
105
|
-
if (err == noErr) {
|
106
|
-
#ifdef DEBUG
|
107
|
-
fprintf(stderr, " FSRef created\n");
|
108
|
-
#endif
|
109
|
-
err = FSNewAlias(NULL, &fsref, &itemAlias);
|
110
|
-
|
111
|
-
if (err == noErr) {
|
112
|
-
#ifdef DEBUG
|
113
|
-
fprintf(stderr, " AliasHandle created\n");
|
114
|
-
#endif
|
115
|
-
err = FSCopyAliasInfo(itemAlias, NULL, NULL, &pathString, NULL, NULL);
|
116
|
-
}
|
117
|
-
|
118
|
-
if (err == noErr) {
|
119
|
-
#ifdef DEBUG
|
120
|
-
fprintf(stderr, " Alias Info copied\n");
|
121
|
-
CFStringGetFileSystemRepresentation(pathString, fullPath, PATH_MAX + 1);
|
122
|
-
fprintf(stderr, " resolved path to: %s\n", fullPath);
|
123
|
-
fprintf(stderr, "\n");
|
176
|
+
|
124
177
|
#endif
|
125
|
-
|
126
|
-
CFArrayAppendValue(config.paths, pathString);
|
127
|
-
}
|
128
|
-
} else {
|
129
|
-
#ifdef DEBUG
|
130
|
-
fprintf(stderr, " assuming path does not YET exist\n");
|
131
|
-
#endif
|
132
|
-
|
133
|
-
CFURLRef pathURL = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault,
|
134
|
-
(const UInt8*)path,
|
135
|
-
strlen(path), true);
|
136
|
-
pathString = CFURLCopyStrictPath(pathURL, NULL);
|
137
|
-
CFArrayAppendValue(config.paths, pathString);
|
138
|
-
CFRelease(pathURL);
|
139
|
-
|
140
|
-
#ifdef DEBUG
|
141
|
-
CFStringGetFileSystemRepresentation(pathString, fullPath, PATH_MAX + 1);
|
142
|
-
fprintf(stderr, " resolved path to: %s\n", fullPath);
|
143
|
-
fprintf(stderr, "\n");
|
144
|
-
#endif
|
145
|
-
}
|
146
|
-
|
147
|
-
if (pathString != NULL) {
|
148
|
-
CFRelease(pathString);
|
149
|
-
}
|
150
|
-
|
151
|
-
if (itemAlias != NULL) {
|
152
|
-
DisposeHandle((Handle)itemAlias);
|
153
|
-
assert(MemError() == noErr);
|
154
|
-
}
|
155
178
|
}
|
156
179
|
|
157
180
|
// Parse commandline settings
|
@@ -212,10 +235,10 @@ static inline void parse_cli_settings(int argc, const char* argv[])
|
|
212
235
|
}
|
213
236
|
|
214
237
|
if (args_info.inputs_num == 0) {
|
215
|
-
|
238
|
+
append_path(".");
|
216
239
|
} else {
|
217
240
|
for (unsigned int i=0; i < args_info.inputs_num; ++i) {
|
218
|
-
|
241
|
+
append_path(args_info.inputs[i]);
|
219
242
|
}
|
220
243
|
}
|
221
244
|
|
@@ -302,7 +325,7 @@ static void tstring_output_format(size_t numEvents,
|
|
302
325
|
|
303
326
|
CFStringRef path = CFStringCreateWithBytes(kCFAllocatorDefault,
|
304
327
|
(const UInt8*)paths[i],
|
305
|
-
strlen(paths[i]),
|
328
|
+
(CFIndex)strlen(paths[i]),
|
306
329
|
kCFStringEncodingUTF8,
|
307
330
|
false);
|
308
331
|
CFDictionarySetValue(event, CFSTR("path"), path);
|