RocketMod / Rocket.Unturned

Unturned 3 implementation of the RocketMod — .NET Game Server Plugin Framework
MIT License
85 stars 111 forks source link

fixed bug where scripts cd into wrong directory #47

Closed nic96 closed 7 years ago

nic96 commented 7 years ago

The scripts didn't work for me out of the box so I fixed them.

Freenex1911 commented 7 years ago

I just tried it and it works without $PWD. A PR is not necessary since they can just adjust the path to their needs.

nic96 commented 7 years ago

The start.sh script might work fine without the change, but not the update.sh script. The update script does not have the expected behaviour. Unturned get's installed in ../../ not in ../ as set in UNTURNED_HOME by default since first the script changes directory int ../../steamcmd then after installing steam it installs Unturned into ../ of the steamcmd directory which is not where the start.sh script looks for it by default.

Another option instead of adding $PWD to the variable is to run cd - before steam installs or updates Unturned so that we are back in the original working directory. Another maybe better solution would be to never change directory in the script in the first place and change the other commands as needed.

Hopefully this makes sense because right now running ./update.sh then ./start.sh will fail at ./start.sh with the following error:

$ ./start.sh 
Steam: diff: ..//Unturned_Data/Plugins/x86/steamclient.so: No such file or directory
cp: cannot create regular file '..//Unturned_Data/Plugins/x86/steamclient.so': No such file or directory
UPDATING

WARNING: The runtime version supported by this application is unavailable.
Using default runtime: v4.0.30319

Unhandled Exception:
System.ComponentModel.Win32Exception (0x80004005): ApplicationName='Unturned.x86', CommandLine='-nographics -batchmode -logfile 'Servers/Rocket/unturned.log' +secureserver/Rocket', CurrentDirectory='', Native error= Cannot find the specified file
at System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) [0x001ee] in <6c7c03f48a9747c8a644da4f63a34480>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.ComponentModel.Win32Exception (0x80004005): ApplicationName='Unturned.x86', CommandLine='-nographics -batchmode -logfile 'Servers/Rocket/unturned.log' +secureserver/Rocket', CurrentDirectory='', Native error= Cannot find the specified file
at System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) [0x001ee] in <6c7c03f48a9747c8a644da4f63a34480>:0