diff --git a/.gitignore b/.gitignore index 86d2e7d3..a1db0e6b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ *.tar.gz .sconsign.dblite bin/ +lib/ include/version.h diff --git a/scripts/%APP-play b/scripts/%APP-play index ecc9a06b..a2d4b073 100644 --- a/scripts/%APP-play +++ b/scripts/%APP-play @@ -1,3 +1,3 @@ #!/bin/bash -. `dirname $0`/ocarina +. `dirname $0`/../lib/ocarina/functions write_to_pipe "play" diff --git a/scripts/Sconscript b/scripts/Sconscript index 644be2d4..bcb99994 100644 --- a/scripts/Sconscript +++ b/scripts/Sconscript @@ -2,7 +2,8 @@ import os, re Import( "env", "DEBUG" ) -bin = os.path.abspath("../bin/%s") +bin = "../bin/%s" +lib = "../lib/ocarina/%s" def create_script(target, source, env): dst = str(target[0].rfile()) @@ -25,7 +26,10 @@ for file in os.listdir("."): elif file[0] == ".": continue - dst = (bin % file).replace("%APP", "ocarina") + dir = bin + if file == "functions": + dir = lib + dst = (dir % file).replace("%APP", "ocarina") files.append(env.Command(dst, file, create_script)) Return('files') diff --git a/scripts/functions b/scripts/functions new file mode 100644 index 00000000..bbd8db1a --- /dev/null +++ b/scripts/functions @@ -0,0 +1,25 @@ +#!/bin/bash + +DEBUG=%DEBUG + +function get_app_dir +{ + dir="$HOME/.%APP" + if [ "$DEBUG" == "True" ]; then + dir="$dir-debug" + fi + echo $dir +} + +function write_to_pipe +{ + pipe=`get_app_dir`/pipe + if [ ! -p $pipe ]; then + exit 0 + fi + + file=`mktemp` + echo "$*" > $file + echo $file > $pipe + rm -f $file +} diff --git a/scripts/ocarina b/scripts/ocarina index 829507ee..e22a5916 100644 --- a/scripts/ocarina +++ b/scripts/ocarina @@ -1,33 +1,9 @@ #!/bin/bash -DEBUG=%DEBUG - -function get_app_dir -{ - dir="$HOME/.%APP" - if [ "$DEBUG" == "True" ]; then - dir="$dir-debug" - fi - echo $dir -} - -function write_to_pipe -{ - pipe=`get_app_dir`/pipe - if [ ! -p $pipe ]; then - exit 0 - fi - - file=`mktemp` - echo "$*" > $file - echo $file > $pipe - rm -f $file -} - -#cmd=`which %%OCARINA%%-$1 2>/dev/null` -#args="${@: +2}" -#if [ "$cmd" ]; then -# $cmd "$args" -#else -# %%BIN%% "$*" -#fi +cmd=`which %%OCARINA%%-$1 2>/dev/null` +args="${@: +2}" +if [ "$cmd" ]; then + $cmd "$args" +else + %%BIN%% "$*" +fi