2727
2828func main () {
2929 if ! isFile ("SII_Decrypt.exe" ) {
30- handleError (errors .New ("SII_Decrypt.exe does not exist! " ))
30+ handleError (errors .New ("SII_Decrypt.exe does not exist" ))
3131 }
3232
3333 err := addDocumentsPathToWatchList ()
@@ -149,7 +149,8 @@ func isDir(path string) bool {
149149}
150150
151151func decryptSii (filePath string ) (bool , error ) {
152- cmd := exec .Command ("SII_Decrypt.exe" , filePath )
152+ pwd , _ := os .Getwd ()
153+ cmd := exec .Command (filepath .Join (pwd , "SII_Decrypt.exe" ), filePath )
153154 buf , err := cmd .Output ()
154155 if err != nil {
155156 if exitErr , ok := err .(* exec.ExitError ); ok {
@@ -325,8 +326,16 @@ func parseCamsCoordinate(cams []string) (string, string) {
325326}
326327
327328func editSii (siiArray []string , location string , rotation string ) (string , error ) {
329+ attachTrailer := 0
328330 for i := range siiArray {
329- if strings .HasPrefix (siiArray [i ], " truck_placement:" ) {
331+ if strings .HasPrefix (siiArray [i ], " assigned_trailer: _nameless" ) {
332+ attachTrailer = 1
333+ } else if strings .HasPrefix (siiArray [i ], " assigned_trailer_connected: false" ) && attachTrailer == 1 {
334+ attachTrailer = 2
335+ siiArray [i ] = " assigned_trailer_connected: true"
336+ } else if strings .HasPrefix (siiArray [i ], " nav_node_position:" ) && attachTrailer == 2 {
337+ siiArray [i ] = " nav_node_position: (0, 0, 0)"
338+ } else if strings .HasPrefix (siiArray [i ], " truck_placement:" ) {
330339 siiArray [i ] = " truck_placement: " + `(` + location + `) (` + rotation + `)`
331340 } else if strings .HasPrefix (siiArray [i ], " trailer_placement:" ) {
332341 siiArray [i ] = ` trailer_placement: (0, 0, 0) (` + rotation + `)`
@@ -346,8 +355,6 @@ func editSii(siiArray []string, location string, rotation string) (string, error
346355 siiArray [i ] = " wheels_wear: 0"
347356 } else if strings .HasPrefix (siiArray [i ], " wheels_wear[" ) {
348357 siiArray [i ] = ""
349- } else if strings .HasPrefix (siiArray [i ], " fuel_relative:" ) {
350- siiArray [i ] = " fuel_relative: 1"
351358 }
352359 }
353360 return strings .Join (siiArray , "\n " ), nil
0 commit comments