Browse Source
Reset files: handle slow computers edge case
master
meriadec
7 years ago
No known key found for this signature in database
GPG Key ID: 1D2FC2305E2CB399
1 changed files with
17 additions and
1 deletions
-
scripts/reset-files.sh
|
@ -9,9 +9,25 @@ cat <<EOF > $TMP_FILE |
|
|
const { app } = require('electron') |
|
|
const { app } = require('electron') |
|
|
console.log(app.getPath('userData')) |
|
|
console.log(app.getPath('userData')) |
|
|
EOF |
|
|
EOF |
|
|
USER_DATA_FOLDER=`timeout --preserve-status 0.5 electron $TMP_FILE || echo` # echo used to ensure status 0 |
|
|
USER_DATA_FOLDER=`timeout 0.5 electron $TMP_FILE || echo` # echo used to ensure status 0 |
|
|
|
|
|
|
|
|
|
|
|
if [ "$USER_DATA_FOLDER" == "" ]; then |
|
|
|
|
|
echo "You probably are on a slow computer. Be patient..." |
|
|
|
|
|
USER_DATA_FOLDER=`timeout 3 electron $TMP_FILE || echo` # echo used to ensure status 0 |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
if [ "$USER_DATA_FOLDER" == "" ]; then |
|
|
|
|
|
echo "Apparently, very very slow computer..." |
|
|
|
|
|
USER_DATA_FOLDER=`timeout 6 electron $TMP_FILE || echo` # echo used to ensure status 0 |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
rm $TMP_FILE |
|
|
rm $TMP_FILE |
|
|
|
|
|
|
|
|
|
|
|
if [ "$USER_DATA_FOLDER" == "" ]; then |
|
|
|
|
|
echo "Could not find the data folder. Bye" |
|
|
|
|
|
exit 0 |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
read -p "> Remove folder \"$USER_DATA_FOLDER\"? (y/n) " -n 1 -r |
|
|
read -p "> Remove folder \"$USER_DATA_FOLDER\"? (y/n) " -n 1 -r |
|
|
echo |
|
|
echo |
|
|
if [[ $REPLY == "y" ]] |
|
|
if [[ $REPLY == "y" ]] |
|
|