Skip to content

Instantly share code, notes, and snippets.

@2xsaiko

2xsaiko/main.m Secret

Created February 24, 2024 10:51
Show Gist options
  • Save 2xsaiko/968b3059176869e6e1b92f215bd350c8 to your computer and use it in GitHub Desktop.
Save 2xsaiko/968b3059176869e6e1b92f215bd350c8 to your computer and use it in GitHub Desktop.
#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