Revision: 14124
http://sourceforge.net/p/skim-app/code/14124
Author: hofman
Date: 2024-03-22 17:11:51 +0000 (Fri, 22 Mar 2024)
Log Message:
-----------
convenience method for resolved file URL
Modified Paths:
--------------
trunk/SKFileUpdateChecker.m
Modified: trunk/SKFileUpdateChecker.m
===================================================================
--- trunk/SKFileUpdateChecker.m 2024-03-22 17:03:00 UTC (rev 14123)
+++ trunk/SKFileUpdateChecker.m 2024-03-22 17:11:51 UTC (rev 14124)
@@ -51,7 +51,8 @@
static BOOL canUpdateFromURL(NSURL *fileURL);
-@interface SKFileUpdateChecker (SKPrivate)
+@interface SKFileUpdateChecker ()
+@property (nonatomic, readonly) NSURL *fileURL;
- (void)fileUpdated;
- (void)noteFileUpdated;
- (void)noteFileMoved;
@@ -60,7 +61,7 @@
@implementation SKFileUpdateChecker
-@dynamic enabled, fileChangedOnDisk, isUpdatingFile;
+@dynamic fileURL, enabled, fileChangedOnDisk, isUpdatingFile;
- (instancetype)initForDocument:(NSDocument *)aDocument {
self = [super init];
@@ -80,6 +81,10 @@
@catch (id) {}
}
+- (NSURL *)fileURL {
+ return [[document fileURL] URLByResolvingSymlinksInPath];
+}
+
- (void)terminate {
[self stop];
@try { [document removeObserver:self forKeyPath:@"fileURL"
context:&SKFileUpdateCheckerObservationContext]; }
@@ -101,7 +106,7 @@
}
- (void)checkForFileReplacement {
- if ([[[document fileURL] URLByResolvingSymlinksInPath]
checkResourceIsReachableAndReturnError:NULL]) {
+ if ([[self fileURL] checkResourceIsReachableAndReturnError:NULL]) {
// the deleted file was replaced at the old path, restart the file
updating for the replacement file and note the update
[self reset];
[self noteFileUpdated];
@@ -118,7 +123,7 @@
- (void)reset {
[self stop];
- NSURL *fileURL = [[document fileURL] URLByResolvingSymlinksInPath];
+ NSURL *fileURL = [self fileURL];
if (fileURL) {
if (fucFlags.enabled && [[NSUserDefaults standardUserDefaults]
boolForKey:SKAutoCheckFileUpdateKey]) {
@@ -183,7 +188,7 @@
}
- (void)fileUpdated {
- NSURL *fileURL = [[document fileURL] URLByResolvingSymlinksInPath];
+ NSURL *fileURL = [self fileURL];
// should never happen
if (fucFlags.isUpdatingFile)
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