File tree 1 file changed +6
-11
lines changed
1 file changed +6
-11
lines changed Original file line number Diff line number Diff line change 7
7
8
8
import Foundation
9
9
10
-
11
10
///
12
11
/// Class to handle actions with GPX files (save, delete, etc..)
13
12
///
@@ -34,17 +33,13 @@ class GPXFileManager: NSObject {
34
33
/// Gets the list of `.gpx` files in Documents directory ordered by modified date
35
34
///
36
35
class var fileList : [ GPXFileInfo ] {
37
- let fileManager = FileManager . default
38
- // Default to app documents directory
39
- var documentsURL = fileManager. urls ( for: . documentDirectory, in: . userDomainMask) [ 0 ]
40
- // If user has a custom folder display the custom folder
41
- if let customFolderURL = Preferences . shared. gpxFilesFolderURL {
42
- documentsURL = customFolderURL
36
+ let documentsURL = GPXFileManager . GPXFilesFolderURL
37
+ if documentsURL. startAccessingSecurityScopedResource ( ) {
38
+ let files = self . fetchFilesList ( from: documentsURL)
39
+ documentsURL. stopAccessingSecurityScopedResource ( )
40
+ return files
43
41
}
44
- _ = documentsURL. startAccessingSecurityScopedResource ( )
45
- let files = self . fetchFilesList ( from: documentsURL)
46
- documentsURL. stopAccessingSecurityScopedResource ( )
47
- return files
42
+ return [ ]
48
43
}
49
44
50
45
///
You can’t perform that action at this time.
0 commit comments