Revision: 14326
http://sourceforge.net/p/skim-app/code/14326
Author: hofman
Date: 2024-06-11 14:19:40 +0000 (Tue, 11 Jun 2024)
Log Message:
-----------
the thefault file manager should now be thread safe
Modified Paths:
--------------
trunk/SKPDFSynchronizer.h
trunk/SKPDFSynchronizer.m
Modified: trunk/SKPDFSynchronizer.h
===================================================================
--- trunk/SKPDFSynchronizer.h 2024-06-11 14:13:32 UTC (rev 14325)
+++ trunk/SKPDFSynchronizer.h 2024-06-11 14:19:40 UTC (rev 14326)
@@ -61,8 +61,6 @@
NSString *syncFileName;
NSDate *lastModDate;
- NSFileManager *fileManager;
-
NSMutableDictionary *sourceFileNames;
id<SKSyncParser> parser;
Modified: trunk/SKPDFSynchronizer.m
===================================================================
--- trunk/SKPDFSynchronizer.m 2024-06-11 14:13:32 UTC (rev 14325)
+++ trunk/SKPDFSynchronizer.m 2024-06-11 14:19:40 UTC (rev 14326)
@@ -72,9 +72,6 @@
sourceFileNames = nil;
shouldKeepRunning = YES;
-
- // it is not safe to use the defaultManager on background threads
- fileManager = [[NSFileManager alloc] init];
}
return self;
}
@@ -132,12 +129,13 @@
#pragma mark Support
- (NSString *)sourceFileForFileName:(NSString *)file isTeX:(BOOL)isTeX {
+ NSFileManager *fm = [NSFileManager defaultManager];
if ([file isAbsolutePath] == NO)
file = [[[self fileName] stringByDeletingLastPathComponent]
stringByAppendingPathComponent:file];
- if (isTeX && [fileManager fileExistsAtPath:file] == NO &&
[SKPDFSynchronizerTexExtensions containsObject:[[file pathExtension]
lowercaseString]] == NO) {
+ if (isTeX && [fm fileExistsAtPath:file] == NO &&
[SKPDFSynchronizerTexExtensions containsObject:[[file pathExtension]
lowercaseString]] == NO) {
for (NSString *extension in SKPDFSynchronizerTexExtensions) {
NSString *tryFile = [file
stringByAppendingPathExtension:extension];
- if ([fileManager fileExistsAtPath:tryFile]) {
+ if ([fm fileExistsAtPath:tryFile]) {
file = tryFile;
break;
}
@@ -149,9 +147,10 @@
- (NSString *)defaultSourceFile {
NSString *file = [[self fileName] stringByDeletingPathExtension];
+ NSFileManager *fm = [NSFileManager defaultManager];
for (NSString *extension in SKPDFSynchronizerTexExtensions) {
NSString *tryFile = [file stringByAppendingPathExtension:extension];
- if ([fileManager fileExistsAtPath:tryFile])
+ if ([fm fileExistsAtPath:tryFile])
return tryFile;
}
return [file
stringByAppendingPathExtension:[SKPDFSynchronizerTexExtensions firstObject]];
@@ -187,7 +186,7 @@
if (theFileName) {
NSString *theSyncFileName = [self syncFileName];
- if (theSyncFileName && [fileManager fileExistsAtPath:theSyncFileName])
{
+ if (theSyncFileName && [[NSFileManager defaultManager]
fileExistsAtPath:theSyncFileName]) {
NSDate *currentModDate = [self lastModDate];
NSDate *modDate = nil;
[[NSURL fileURLWithPath:syncFileName isDirectory:NO]
getResourceValue:&modDate forKey:NSURLAttributeModificationDateKey error:NULL];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit