Skip to content

Commit 4202429

Browse files
author
twojstaryzdomu
committed
Change name to LOG_DIR and add a configuration menu
1 parent cb24243 commit 4202429

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

scriptmodules/supplementary/runcommand.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ function install_bin_runcommand() {
4343
iniSet "governor" ""
4444
iniSet "disable_menu" "0"
4545
iniSet "image_delay" "2"
46+
iniSet "log_dir" ""
4647
chown $user:$user "$configdir/all/runcommand.cfg"
4748
fi
4849
if [[ ! -f "$configdir/all/runcommand-launch-dialog.cfg" ]]; then
@@ -110,6 +111,7 @@ function gui_runcommand() {
110111
'disable_joystick=0' \
111112
'image_delay=2' \
112113
'governor=' \
114+
'log_dir=' \
113115
)"
114116

115117
[[ -z "$governor" ]] && governor="Default: don't change"
@@ -137,6 +139,7 @@ function gui_runcommand() {
137139

138140
options+=(4 "Launch image delay in seconds (currently $image_delay)")
139141
options+=(5 "CPU governor configuration (currently: $governor)")
142+
options+=(6 "Set log/scratch directory (currently: ${log_dir:-/dev/shm})")
140143

141144
local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
142145
[[ -z "$choice" ]] && break
@@ -159,6 +162,11 @@ function gui_runcommand() {
159162
5)
160163
governor_runcommand
161164
;;
165+
6)
166+
cmd=(dialog --backtitle "$__backtitle" --inputbox "Please enter the log directory" 10 60 "$log_dir")
167+
choice=$("${cmd[@]}" 2>&1 >/dev/tty)
168+
iniSet "log_dir" "$choice"
169+
;;
162170
esac
163171
done
164172
}

scriptmodules/supplementary/runcommand/runcommand.sh

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,6 @@
7979

8080
ROOTDIR="/opt/retropie"
8181
CONFIGDIR="$ROOTDIR/configs"
82-
OUTPUTDIR="/dev/shm"
83-
[ -d "${OUTPUTDIR}" ] \
84-
&& [ -w "${OUTPUTDIR}" ] \
85-
|| OUTPUTDIR=/tmp
86-
LOG="${OUTPUTDIR}/runcommand.log"
8782

8883
RUNCOMMAND_CONF="$CONFIGDIR/all/runcommand.cfg"
8984
VIDEO_CONF="$CONFIGDIR/all/videomodes.cfg"
@@ -123,6 +118,10 @@ function get_config() {
123118
iniGet "image_delay"
124119
IMAGE_DELAY="$ini_value"
125120
[[ -z "$IMAGE_DELAY" ]] && IMAGE_DELAY=2
121+
iniGet "log_dir"
122+
LOG_DIR="$ini_value"
123+
[[ -z "$LOGDIR" ]] && LOGDIR="/dev/shm"
124+
LOG="$LOG_DIR/runcommand.log"
126125
fi
127126

128127
if [[ -n "$DISPLAY" ]] && $XRANDR &>/dev/null; then
@@ -933,7 +932,7 @@ function switch_fb_res() {
933932

934933
function build_xinitrc() {
935934
local mode="$1"
936-
local xinitrc="${OUTPUTDIR}/retropie_xinitrc"
935+
local xinitrc="$LOG_DIR/retropie_xinitrc"
937936

938937
case "$mode" in
939938
clear)
@@ -1072,7 +1071,7 @@ function config_backend() {
10721071
}
10731072
10741073
function retroarch_append_config() {
1075-
local conf="${OUTPUTDIR}/retroarch.cfg"
1074+
local conf="$LOG_DIR/retroarch.cfg"
10761075
local dim
10771076
10781077
# only for retroarch emulators
@@ -1321,7 +1320,7 @@ function launch_command() {
13211320
}
13221321
13231322
function log_info() {
1324-
echo -e "$SYSTEM\n$EMULATOR\n$ROM\n$COMMAND" >${OUTPUTDIR}/runcommand.info
1323+
echo -e "$SYSTEM\n$EMULATOR\n$ROM\n$COMMAND" >"$LOG_DIR/runcommand.info"
13251324
}
13261325
13271326
function runcommand() {

0 commit comments

Comments
 (0)