Skip to content

Commit

Permalink
cleanup cli scripts
Browse files Browse the repository at this point in the history
remove js version due to difficulties with cli mode
GOLUWA_CURRENT_DIRECTORY > GOLUWA_WORKING_DIRECTORY
  • Loading branch information
CapsAdmin committed Mar 17, 2018
1 parent 7c20fd1 commit 322185f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 109 deletions.
2 changes: 1 addition & 1 deletion core/lua/libraries/system.lua
Expand Up @@ -5,7 +5,7 @@ runfile("platforms/" .. PLATFORM .. "/system.lua", system)
function system.GetWorkingDirectory()

if CLI then
local dir = os.getenv("GOLUWA_CURRENT_DIRECTORY")
local dir = os.getenv("GOLUWA_WORKING_DIRECTORY")
if dir then
return vfs.FixPathSlashes("os:" .. dir .. "/")
end
Expand Down
2 changes: 1 addition & 1 deletion goluwa
@@ -1,6 +1,6 @@
#!/bin/sh
export GOLUWA_START_TIME=$(date +%s%N)
export GOLUWA_CURRENT_DIRECTORY=$PWD
export GOLUWA_WORKING_DIRECTORY=$PWD

basetime=$(date +%s%N)

Expand Down
34 changes: 17 additions & 17 deletions goluwa.cmd
@@ -1,33 +1,33 @@
@echo off & set GOLUWA_START_TIME="%time%" & PowerShell -nologo -noprofile -noninteractive Invoke-Expression ('$args=(''%*'').split('' '');'+'$PSScriptRoot=(''%~dp0'');$env:GOLUWA_CURRENT_DIRECTORY=(''%cd%'');'+((Get-Content -Raw %~dp0%~n0%~x0 ) -Replace '^.*goto :EOF')); & goto :EOF

$ROOT_DIR = $PSScriptRoot
$ROOT_DIR = $([System.IO.Path]::GetFullPath("$ROOT_DIR"))
$ROOT_DIR = $ROOT_DIR.substring(0, $ROOT_DIR.Length - 1)
@echo off & set GOLUWA_START_TIME="%time%" & PowerShell -nologo -noprofile -noninteractive Invoke-Expression ('$args=(''%*'').split('' '');'+'$PSScriptRoot=(''%~dp0'');$env:GOLUWA_WORKING_DIRECTORY=(''%cd%'');'+((Get-Content -Raw %~dp0%~n0%~x0 ) -Replace '^.*goto :EOF')); & goto :EOF

if (((gwmi -Query "select osarchitecture from win32_operatingsystem").OSArchitecture) -Match "64") {
$ARCH = "x64"
} else {
$ARCH = "x86"
}

$BINARIES_LOCATION = "https://gitlab.com/CapsAdmin/goluwa-binaries-windows_$ARCH/raw/master"

function Download($url, $location) {
if(!(Test-Path "$location")) {
Write-Host -NoNewline "'$url' >> '$location' ... "
(New-Object System.Net.WebClient).DownloadFile($url, "$location")
$path = "$(Get-Location)\$location"
if(!(Test-Path "$path")) {
Write-Host -NoNewline "'$url' >> '$path' ... "
(New-Object System.Net.WebClient).DownloadFile($url, "$path")
Write-Host "OK"
}
}

New-Item -ItemType Directory -Force -Path "$ROOT_DIR\data\windows_$ARCH" | Out-Null
Set-Location "$ROOT_DIR\data\windows_$ARCH\"
$ROOT_DIR = $([System.IO.Path]::GetFullPath("$PSScriptRoot"))
$ROOT_DIR = $ROOT_DIR.substring(0, $ROOT_DIR.Length - 1)
Set-Location "$ROOT_DIR"

Download "https://gitlab.com/CapsAdmin/goluwa-binaries-windows_$ARCH/raw/master/luajit.exe" "$ROOT_DIR\data\windows_$ARCH\luajit.exe"
Download "https://gitlab.com/CapsAdmin/goluwa-binaries-windows_$ARCH/raw/master/lua51.dll" "$ROOT_DIR\data\windows_$ARCH\lua51.dll"
Download "https://gitlab.com/CapsAdmin/goluwa-binaries-windows_$ARCH/raw/master/vcruntime140.dll" "$ROOT_DIR\data\windows_$ARCH\vcruntime140.dll"
New-Item -ItemType Directory -Force -Path "data\windows_$ARCH" | Out-Null
Set-Location "data\windows_$ARCH\"
Download "$BINARIES_LOCATION/luajit.exe" "luajit.exe"
Download "$BINARIES_LOCATION/lua51.dll" "lua51.dll"
Download "$BINARIES_LOCATION/vcruntime140.dll" "vcruntime140.dll"

if(!(Test-Path "$ROOT_DIR\core\lua\boot.lua" -PathType Leaf)) {
New-Item -ItemType Directory -Force -Path "$ROOT_DIR\core\lua" | Out-Null
Download "https://gitlab.com/CapsAdmin/goluwa/raw/master/core/lua/boot.lua" "$ROOT_DIR\core\lua\boot.lua"
}
New-Item -ItemType Directory -Force -Path "core\lua" | Out-Null
Download "https://gitlab.com/CapsAdmin/goluwa/raw/master/core/lua/boot.lua" "..\..\core\lua\boot.lua"

.\luajit.exe "../../core/lua/boot.lua" $args
90 changes: 0 additions & 90 deletions goluwa_js.cmd

This file was deleted.

0 comments on commit 322185f

Please sign in to comment.