diff --git a/Scenes/GamePaths.gd b/Scenes/GamePaths.gd index 98f9e723..e8b29b37 100644 --- a/Scenes/GamePaths.gd +++ b/Scenes/GamePaths.gd @@ -188,14 +188,21 @@ func get_precise_filepath(lookInDirectory, lookForFileName): func set_keeperfx_version(): var output = [] - var getVer = Settings.unearthdata.plus_file("GetVersion.cmd") - var _exit_code = OS.execute(getVer, [EXECUTABLE_PATH], true, output) + match OS.get_name(): + "Windows": + var powershell_script = "[System.Diagnostics.FileVersionInfo]::GetVersionInfo('%s').FileVersion" % EXECUTABLE_PATH + OS.execute("powershell.exe", ["-Command", powershell_script], true, output) + "X11": + var script = "" + script += "executablePath='" + EXECUTABLE_PATH + "'\n" + script += "versionInfo=$(stat -c %v \"$executablePath\")\n" + script += "echo \"$versionInfo\"\n" + OS.execute("bash", ["-c", script], true, output) + if output.size() == 1: KEEPERFX_VERSION_STRING = output[0].strip_edges() - #KEEPERFX_VERSION_INT = int(KEEPERFX_VERSION_STRING.replace(".","")) else: KEEPERFX_VERSION_STRING = "Undetected" - #KEEPERFX_VERSION_INT = 0 #func load_command_line_from_settings(COMMAND_LINE): # COMMAND_LINE = COMMAND_LINE.replace("%DIR%", GAME_DIRECTORY) diff --git a/unearthdata/GetVersion.cmd b/unearthdata/GetVersion.cmd deleted file mode 100644 index d0883cb0..00000000 --- a/unearthdata/GetVersion.cmd +++ /dev/null @@ -1,22 +0,0 @@ -@if (@this==@isBatch) @then -@echo off - setlocal enableextensions - - set "file=%~f1" - if not exist "%file%" goto :eof - - cscript //nologo //e:jscript "%~f0" /file:"%file%" - - endlocal - - exit /b -@end - var file = WScript.Arguments.Named.Item('file').replace(/\\/g,'\\\\'); - var wmi = GetObject('winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\cimv2') - var files = new Enumerator(wmi.ExecQuery('Select Version from CIM_datafile where name=\''+file+'\'')) - - while (!files.atEnd()){ - WScript.StdOut.WriteLine(files.item().Version); - files.moveNext(); - }; - WScript.Quit(0) \ No newline at end of file