Funkin icon indicating copy to clipboard operation
Funkin copied to clipboard

[ENHANCEMENT] FileUtil additions + sandboxing

Open cyn0x8 opened this issue 7 months ago • 9 comments

Briefly describe the issue(s) fixed.

im currently working on a mod launcher/manager/updater mod, and require certain file manipulation functions that are blacklisted and also not currently present in FileUtil, so this pr aims to expand FileUtil functionality by adding the following:

moveFile(path:String, destination:String):Void

deleteFile(path:String):Void

getFileSize(path:String):Int

isDirectory(path:String):Bool

readDir(path:String):Array<String>

moveDir(path:String, destination:String, ?ignore:Array<String>):Void

deleteDir(path:String, recursive:Bool = false, ?ignore:Array<String>):Void

getDirSize(path:String):Int

rename(path:String, newName:String, keepExtension:Bool = true):Void

this pr also sandboxes all the functions!! the core functionality is now housed in FileUtilBase (used only internally, blacklisted in scripts), which FileUtil uses, sanitizing the paths first and preventing them from leaving the game folder

functions that have the capability to modify/delete are prevented from messing with assets, manifest and everything in it, plugins and everything in it, and the dlls and game executable


all functions above have been tested; if anyone finds any faults, please make them known

cyn0x8 avatar Jul 15 '24 02:07 cyn0x8