//
// main.m
// changecfile
// Created by miaoqushidai on 2023/6/29.
//
#import <Foundation/Foundation.h>
void changeFilePath(NSString* path,NSString* name){
NSString* src = @"/Users/mqsd/Documents/BoomBoy/4HaiwZian/Client/BoomBoyNew/Build/iOS/06291405/App";
NSString *appPath =[[NSBundle mainBundle] bundlePath];
NSString *str=[NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
str = [str stringByReplacingOccurrencesOfString:src withString:appPath];
NSString *des = [NSString stringWithFormat:@"%@/%@", appPath, @"Libraries/lumps"];
NSString *filePath2 = [NSString stringWithFormat:@"%@/%@", des,name];
NSError* er;
BOOL success = [str writeToFile:filePath2 atomically:true encoding:NSUTF8StringEncoding error: &er];//error:nil
if(success)
{
NSLog(@"Writing file is successful!");
}
else
{
NSLog(@"Write file is failed, with error : %@", [er localizedDescription]);
}
NSLog(@"%@",filePath2);
}
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSFileManager *manager = [NSFileManager defaultManager];
NSString *appPath =[[NSBundle mainBundle] bundlePath];
NSString *filePath = [NSString stringWithFormat:@"%@/%@", appPath, @"Libraries/lumps"];
NSArray *allPath =[manager subpathsAtPath:filePath];
for (NSString *subPath in allPath) {
NSString* fileName = [NSString stringWithFormat:@"%@/%@",filePath,subPath];
changeFilePath(fileName,subPath);
}
NSLog(@"%@",appPath);
}
return 0;
}