Create our directories at startup
This commit is contained in:
parent
97c1d61f0f
commit
5484c4fec6
@ -60,6 +60,7 @@ Firestarter, in addition to spawning the programs in the default configs, also i
|
||||
| --: | --- |
|
||||
| 0 | Success |
|
||||
| 40 | Firestarter is already running |
|
||||
| 41 | Failed to initialize |
|
||||
| 50 | Unrecognized argument |
|
||||
| 51 | Invalid option for an argument |
|
||||
| 52 | Failed to create configuration directory |
|
||||
|
12
firestarter
12
firestarter
@ -13,9 +13,10 @@ declare -r _name="$(basename -- "$0")"
|
||||
declare -r _sessionid="$(< /proc/self/sessionid)"
|
||||
# Options
|
||||
declare _optconfigdir="${XDG_CONFIG_HOME:-$HOME/.config}/$_name"
|
||||
declare _optdryrun
|
||||
declare _optdatadir="${XDG_DATA_HOME:-$HOME/.local/share}/$_name"
|
||||
declare _optrundir="${XDG_RUNTIME_DIR:-/run/user/$UID}/$_name"
|
||||
declare _optlogdir="$_optdatadir/logs"
|
||||
declare _optdryrun
|
||||
declare -i _opthelp
|
||||
declare -i _optverbose
|
||||
# Working variables
|
||||
@ -225,11 +226,16 @@ step_preexecute() {
|
||||
[ -n "$_optdryrun" ] && return 0
|
||||
# Execute a user rc if it exists
|
||||
[ -r "$HOME/.firestarterrc" ] && . "$HOME/.firestarterrc"
|
||||
#[ -r "$HOME/.xsessionrc" ] && . "$HOME/.xsessionrc"
|
||||
export XDG_CURRENT_DESKTOP="${XDG_CURRENT_DESKTOP:-firestarter}"
|
||||
[ -n "$FIRESTARTER" ] && [ "$FIRESTARTER_DISPLAY" == "$DISPLAY" ] error "Firestarter is already running on $DISPLAY: $FIRESTARTER" 55
|
||||
export FIRESTARTER="$BASHPID"
|
||||
export FIRESTARTER_DISPLAY="$DISPLAY"
|
||||
export XDG_CURRENT_DESKTOP="${XDG_CURRENT_DESKTOP:-firestarter}"
|
||||
# Create required directories
|
||||
for dir in $_optconfigdir $_optdatadir $_optrundir $_optlogdir; do
|
||||
if ! mkdir -p "$dir"; then
|
||||
error "Failed to create critical directory: $dir" 41
|
||||
fi
|
||||
done
|
||||
# dbus
|
||||
if [ -n "$DBUS_SESSION_BUS_ADDRESS" ]; then
|
||||
# We already have a bus started; use it
|
||||
|
Loading…
Reference in New Issue
Block a user