mac friendly version
This commit is contained in:
parent
db2baeef06
commit
4d98f47c25
15
flash
15
flash
|
|
@ -44,9 +44,14 @@
|
||||||
|
|
||||||
# Remember User's Starting Directory
|
# Remember User's Starting Directory
|
||||||
PWD="$(pwd)"
|
PWD="$(pwd)"
|
||||||
# Where Decks Are Located
|
# Where Decks Are Located for linux & mac
|
||||||
DIR="$HOME/.local/share/flash"
|
OS="$(uname)"
|
||||||
# Where the example deck with be placed and named
|
case "$OS" in
|
||||||
|
"Darwin") DIR="$HOME/Library/Application Support/flash" ;;
|
||||||
|
"Linux") DIR="$HOME/.local/share/flash" ;;
|
||||||
|
*) DIR="$HOME/.local/share/flash" ;;
|
||||||
|
esac
|
||||||
|
# Where the example deck will be placed and named
|
||||||
EXAMPLE_DECK="$DIR/deck.csv"
|
EXAMPLE_DECK="$DIR/deck.csv"
|
||||||
# Track High score
|
# Track High score
|
||||||
HIGH_SCORE="$DIR/.highscore"
|
HIGH_SCORE="$DIR/.highscore"
|
||||||
|
|
@ -168,7 +173,7 @@ main(){
|
||||||
fi
|
fi
|
||||||
clear
|
clear
|
||||||
|
|
||||||
COUNTER="$(($COUNTER+1))" # Increment count for above test and card review count increment
|
COUNTER="$(($COUNTER+1))" # Increment count for card review count increment
|
||||||
|
|
||||||
if [ "${q[3]}" = 0 ]; then
|
if [ "${q[3]}" = 0 ]; then
|
||||||
NEW_ITEM_SCORE=0
|
NEW_ITEM_SCORE=0
|
||||||
|
|
@ -201,7 +206,7 @@ main(){
|
||||||
|
|
||||||
# Update item score for each flashcard item
|
# Update item score for each flashcard item
|
||||||
sed -i "s/${q[0]}:${q[1]}:${q[2]}:${q[3]}/${q[0]}:${q[1]}:${q[2]}:$NEW_ITEM_SCORE/g" "$DECK"
|
sed -i "s/${q[0]}:${q[1]}:${q[2]}:${q[3]}/${q[0]}:${q[1]}:${q[2]}:$NEW_ITEM_SCORE/g" "$DECK"
|
||||||
# Update highscore if new highscore is achieved
|
# If no highscore currently set, set it.
|
||||||
if [ -z "$(cat $HIGH_SCORE)" ]; then
|
if [ -z "$(cat $HIGH_SCORE)" ]; then
|
||||||
echo "$COUNTER" > "$HIGH_SCORE"
|
echo "$COUNTER" > "$HIGH_SCORE"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue