-
-
Save 2xsaiko/968b3059176869e6e1b92f215bd350c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
int main(int argc, const char **argv) { | |
@autoreleasepool { | |
NSFileManager *fm = [[NSFileManager alloc] init]; | |
NSURL *url = [NSURL fileURLWithPath:@"/Users/saiko/Library/Mobile Documents/com~apple~CloudDocs/Userscripts"]; | |
NSError *error = nil; | |
NSArray<NSURL *> *arr = [fm contentsOfDirectoryAtURL:url | |
includingPropertiesForKeys:@[] | |
options:0 | |
error:&error]; | |
if (error) { | |
NSLog(@"error: %@", error); | |
return 0; | |
} | |
for (NSURL *el in arr) { | |
NSLog(@"%@", el); | |
NSError *error = nil; | |
NSString *content = [NSString stringWithContentsOfURL:el | |
encoding:NSUTF8StringEncoding | |
error:&error]; | |
if (error) { | |
NSLog(@"error: %@", error); | |
continue; | |
} | |
NSLog(@"%@", content); | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment