Open main menu
Posts
Gists
Guilds
Users
Decipher
Docs
Open user menu
Log in
Sign up
Create a new gist
Posts
Gists
Guilds
Users
Decipher
Docs
Files
shex.src
shex.src
//command: shex (shellexec)
if not params or params[0] == "-h" or params[0] == "--help" then exit(launch_path.split("/")[-1]+" [source] [args]")
args = params[1:].join(" ")
if params[0].indexOf(".src") then
source = get_shell.host_computer.File(current_path + "/" + params[0])
if not source then exit(params[0] + " not found.")
if source != null then
cache_path = home_dir+"/"+"Cache"+"/"+"shex"
if get_shell.host_computer.File(cache_path) == null then
get_shell.host_computer.create_folder(home_dir,"Cache")
get_shell.host_computer.create_folder(home_dir+"/"+"Cache","shex")
end if
src = get_shell.host_computer.File(current_path+"/"+params[0])
md5sum = md5(get_shell.host_computer.File(current_path+"/"+params[0]).get_content)
program = cache_path+"/"+md5sum
for file in get_shell.host_computer.File(cache_path).get_files
if file.name != md5sum then continue
if file.name == md5sum then
get_shell.launch(program, args)
exit
end if
end for
print( get_shell.build(current_path+"/"+params[0],cache_path,false) )
bin = get_shell.host_computer.File(cache_path+"/"+params[0].remove(".src"))
if bin != null then
get_shell.host_computer.File(cache_path+"/"+params[0].remove(".src")).rename(md5sum)
else
exit("File not compiled")
end if
get_shell.launch(program, args)
exit
end if
end if
end if