WIP: Windows install/starup tweaks
This commit is contained in:
parent
9f1763ec1c
commit
4e3c5d7202
@ -27,7 +27,8 @@ main(_) ->
|
||||
|
||||
unpack(OS, ZompDir) ->
|
||||
BaseDir = filename:dirname(ZompDir),
|
||||
ok = erl_tar:extract("zomp.tar.gz", [compressed, {cwd, BaseDir}]),
|
||||
{ok, Files} = zip:extract("zomp.zip", [{cwd, BaseDir}]),
|
||||
ok = io:format("Extracted: ~tp~n", [Files]),
|
||||
add_launcher(OS, ZompDir).
|
||||
|
||||
|
||||
@ -37,13 +38,13 @@ unpack(OS, ZompDir) ->
|
||||
ZompDir :: file:filename().
|
||||
|
||||
add_launcher({unix, linux}, ZompDir) ->
|
||||
add_unix_link(ZompDir),
|
||||
ok = add_unix_link(ZompDir),
|
||||
halt(0);
|
||||
add_launcher({unix, _}, ZompDir) ->
|
||||
add_unix_link(ZompDir),
|
||||
ok = add_unix_link(ZompDir),
|
||||
halt(0);
|
||||
add_launcher({win32, nt}, _ZompDir) ->
|
||||
ok = io:format("This is going to be a bit of a rodeo...~n"),
|
||||
add_launcher({win32, nt}, ZompDir) ->
|
||||
ok = add_windows_link(ZompDir),
|
||||
halt(0).
|
||||
|
||||
|
||||
@ -86,6 +87,27 @@ add_unix_link(ZompDir) ->
|
||||
io:format(Message, [Target, Link, HomeBin]).
|
||||
|
||||
|
||||
-spec add_windows_link(ZompDir) -> ok
|
||||
when ZompDir :: file:filename().
|
||||
|
||||
add_windows_link(ZompDir) ->
|
||||
Home = filename:join(os:getenv("HOMEDRIVE"), os:getenv("HOMEPATH")),
|
||||
Launcher = filename:join(ZompDir, "zx.cmd"),
|
||||
LauncherH = filename:join(ZompDir, "zxh.cmd"),
|
||||
Vapor = filename:join(ZompDir, "vapor.cmd"),
|
||||
Target = filename:join(Home, "zx.cmd"),
|
||||
TargetH = filename:join(Home, "zxh.cmd"),
|
||||
VaporL = filename:join([Home, "Desktop", "Vapor.cmd"]),
|
||||
{ok, _} = file:copy(Launcher, Target),
|
||||
{ok, _} = file:copy(LauncherH, TargetH),
|
||||
{ok, _} = file:copy(Vapor, VaporL),
|
||||
Message =
|
||||
"`zx` and `zxh` launch scripts have been added to ~p~n"
|
||||
"(available from cmd.exe in your home directory)~n"
|
||||
"A GUI program launcher script has been added to the desktop.~n",
|
||||
io:format(Message, [Home]).
|
||||
|
||||
|
||||
-spec os_cmd(Command :: string()) -> ok.
|
||||
|
||||
os_cmd(Command) ->
|
||||
|
||||
16
packup
16
packup
@ -5,18 +5,18 @@
|
||||
main(_) ->
|
||||
{ok, BV} = file:read_file("zomp/etc/version.txt"),
|
||||
Version = string:strip(binary_to_list(BV), both, $\n),
|
||||
Tar = "zomp.tar.gz",
|
||||
ok = erl_tar:create(Tar, ["zomp"], [compressed]),
|
||||
Zip = "zx-" ++ Version ++ ".zip",
|
||||
ZipFiles =
|
||||
Inner = "zomp.zip",
|
||||
Outer = "zx-" ++ Version ++ ".zip",
|
||||
{ok, Inner} = zip:create(Inner, ["zomp"]),
|
||||
Files =
|
||||
["install.escript",
|
||||
"install_unix",
|
||||
"uninstall_unix",
|
||||
"README.md",
|
||||
"README.install",
|
||||
"LICENSE",
|
||||
Tar],
|
||||
{ok, Zip} = zip:create(Zip, ZipFiles),
|
||||
ok = file:delete(Tar),
|
||||
ok = io:format("~ts~n", [Zip]),
|
||||
Inner],
|
||||
{ok, Outer} = zip:create(Outer, Files),
|
||||
ok = file:delete(Inner),
|
||||
ok = io:format("~ts~n", [Outer]),
|
||||
halt(0).
|
||||
|
||||
1
vapor.cmd
Normal file
1
vapor.cmd
Normal file
@ -0,0 +1 @@
|
||||
start /min cmd.exe /c "%HOMEDRIVE%%HOMEPATH%\zx" run vapor
|
||||
4
zomp/zx
4
zomp/zx
@ -11,6 +11,10 @@ export ZX_DIR="$ZOMP_DIR/lib/otpr/zx/$ZX_VERSION"
|
||||
|
||||
start_dir="$PWD"
|
||||
cd "$ZX_DIR"
|
||||
if [ ! -f ebin/zx.erl ]
|
||||
then
|
||||
chmod +x make_zx
|
||||
./make_zx
|
||||
fi
|
||||
cd "$start_dir"
|
||||
erl -noshell -pa "$ZX_DIR/ebin" -run zx do -extra $@
|
||||
|
||||
14
zomp/zx.cmd
14
zomp/zx.cmd
@ -1,9 +1,13 @@
|
||||
@ECHO OFF
|
||||
|
||||
REM Prepare the environment for ZX and launch it
|
||||
|
||||
set ZOMP_DIR="%LOCALAPPDATA%\zomp"
|
||||
set /P VERSION=<"%ZOMP_DIR%\etc\version.txt"
|
||||
set ZX_DIR="%ZOMP_DIR%\lib\otpr\zx\%VERSION%"
|
||||
pushd %ZX_DIR%
|
||||
escript.exe make_zx
|
||||
set ZOMP_DIR=%ZOMP_DIR:"=%
|
||||
set /P ZX_VERSION=<"%ZOMP_DIR%\etc\version.txt"
|
||||
set ZX_DIR=%ZOMP_DIR%\lib\otpr\zx\%ZX_VERSION%
|
||||
set ZX_DIR=%ZX_DIR:"=%
|
||||
pushd "%ZX_DIR%"
|
||||
if not exist ebin\zx.erl "C:\Program Files\erl10.6\bin\escript.exe" make_zx
|
||||
popd
|
||||
erl.exe -pa "%ZX_DIR%/ebin" -run zx run "%*"
|
||||
"C:\Program Files\erl10.6\bin\erl.exe" -noshell -pa "%ZX_DIR%/ebin" -run zx do -extra %*
|
||||
|
||||
6
zomp/zxh
6
zomp/zxh
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
if [ -f "$HOME/.bash_profile" ]
|
||||
then
|
||||
@ -11,6 +11,10 @@ export ZX_DIR="$ZOMP_DIR/lib/otpr/zx/$ZX_VERSION"
|
||||
|
||||
start_dir="$PWD"
|
||||
cd "$ZX_DIR"
|
||||
if [ ! -f ebin/zx.erl ]
|
||||
then
|
||||
chmod +x make_zx
|
||||
./make_zx
|
||||
fi
|
||||
cd "$start_dir"
|
||||
erl -pa "$ZX_DIR/ebin" -run zx do -extra $@
|
||||
|
||||
14
zomp/zxh.cmd
14
zomp/zxh.cmd
@ -1,9 +1,13 @@
|
||||
@ECHO OFF
|
||||
|
||||
REM Prepare the environment for ZX and launch it
|
||||
|
||||
set ZOMP_DIR="%LOCALAPPDATA%\zomp"
|
||||
set /P VERSION=<"%ZOMP_DIR%\etc\version.txt"
|
||||
set ZX_DIR="%ZOMP_DIR%\lib\otpr\zx\%VERSION%"
|
||||
pushd %ZX_DIR%
|
||||
escript.exe make_zx
|
||||
set ZOMP_DIR=%ZOMP_DIR:"=%
|
||||
set /P ZX_VERSION=<"%ZOMP_DIR%\etc\version.txt"
|
||||
set ZX_DIR=%ZOMP_DIR%\lib\otpr\zx\%ZX_VERSION%
|
||||
set ZX_DIR=%ZX_DIR:"=%
|
||||
pushd "%ZX_DIR%"
|
||||
if not exist ebin\zx.erl "C:\Program Files\erl10.6\bin\escript.exe" make_zx
|
||||
popd
|
||||
erl.exe -pa "%ZX_DIR%/ebin" -run zx run "%*"
|
||||
"C:\Program Files\erl10.6\bin\werl.exe" -pa "%ZX_DIR%/ebin" -run zx do -extra %*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user