ref: a0d10e2e828768cdb062ba4a7f5aab5c2e1931e3
parent: 8f52421792e250571f8a6e9aee77d27d7807260f
author: Skyrbunny <tallesttower1@gmail.com>
date: Fri Sep 8 13:56:42 EDT 2023
Changed to MkdirAll
binary files a/ricket b/ricket differ
--- a/ricket.go
+++ b/ricket.go
@@ -53,7 +53,7 @@
// Read program
wasm, err := os.ReadFile(os.Args[2])
if err != nil {
- log.Panicf("failed to read WASM file: %v", err)
+ log.Panicf("failed to read WASM file: %v\n", err)
}
var wasmArgs []string
@@ -75,7 +75,7 @@
_, err = r.InstantiateWithConfig(ctx, wasm, conf)
if err != nil {
- log.Panicf("failed to instantiate WASM program: %v", err)
+ log.Panicf("failed to instantiate WASM program: %v\n", err)
}
}
@@ -90,14 +90,11 @@
bin_dir := os.Args[4]
program_name := os.Args[3]
- err := os.Mkdir(bin_dir, fs.ModeAppend)
+ err := os.MkdirAll(bin_dir+"/"+program_name, fs.ModeAppend)
if err != nil {
- fmt.Printf("Error while making destination directory: %s", err)
+ fmt.Printf("Error while making destination directory: %s\n", err)
+ return
}
- err = os.Mkdir(bin_dir+"/"+program_name, fs.ModeAppend)
- if err != nil {
- fmt.Printf("Error while making destination directory: %s", err)
- }
{ // Step 1: Copy wasm file
_, wasm_filename := path.Split(wasm_path) // make sure we only get the wasm bit
@@ -104,12 +101,12 @@
dst := fmt.Sprintf("%s/%s/%s", bin_dir, program_name, wasm_filename)
dest_file, err := os.Create(dst)
if err != nil {
- fmt.Printf("Error while copying wasm file: %s", err)
+ fmt.Printf("Error while copying wasm file: %s\n", err)
return
}
wasm_file, err := os.Open(wasm_path)
if err != nil {
- fmt.Printf("Error while copying wasm file: %s", err)
+ fmt.Printf("Error while copying wasm file: %s\n", err)
return
}
@@ -121,17 +118,17 @@
if !omit {
ricket_path, err := os.Executable()
if err != nil {
- fmt.Printf("Error while copying ricket file: %s", err)
+ fmt.Printf("Error while copying ricket file: %s\n", err)
return
}
ricket_exec, err := os.Open(ricket_path)
if err != nil {
- fmt.Printf("Error while copying ricket file: %s", err)
+ fmt.Printf("Error while copying ricket file: %s\n", err)
return
}
dest_file, err := os.Create(fmt.Sprintf("%s/%s/ricket", bin_dir, program_name))
if err != nil {
- fmt.Printf("Error while copying ricket file: %s", err)
+ fmt.Printf("Error while copying ricket file: %s\n", err)
return
}
@@ -143,7 +140,7 @@
dst := fmt.Sprintf("%s/%s/%s", bin_dir, program_name, program_name)
rc, err := os.Create(dst)
if err != nil {
- fmt.Printf("Error while creating rc file: %s", err)
+ fmt.Printf("Error while creating rc file: %s\n", err)
return
}
rc.Write([]byte(format_rc(wasm_path)))
@@ -153,7 +150,7 @@
output := format_install(program_name)
dst, err := os.Create(fmt.Sprintf("%s/mkfile", bin_dir))
if err != nil {
- fmt.Printf("Error while writing install file: %s", err)
+ fmt.Printf("Error while writing install file: %s\n", err)
return
}
dst.Write([]byte(output))