From e244e0c2ed30a1323a0cb6a4b00c1ab6e67ec33f Mon Sep 17 00:00:00 2001 From: pengzhile Date: Mon, 27 Sep 2021 10:02:07 +0800 Subject: [PATCH] add temporary reset scripts --- scripts/temp_reset_eval_mac_linux.sh | 25 ++++++++++++++++++++ scripts/temp_reset_eval_windows.vbs | 34 ++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100755 scripts/temp_reset_eval_mac_linux.sh create mode 100644 scripts/temp_reset_eval_windows.vbs diff --git a/scripts/temp_reset_eval_mac_linux.sh b/scripts/temp_reset_eval_mac_linux.sh new file mode 100755 index 0000000..94e8a93 --- /dev/null +++ b/scripts/temp_reset_eval_mac_linux.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# reset jetbrains ide evals for now + +OS_NAME=$(uname -s) +JB_PRODUCTS="IntelliJIdea CLion PhpStorm GoLand PyCharm WebStorm Rider DataGrip RubyMine AppCode" + +if [ $OS_NAME == "Darwin" ]; then + echo 'macOS:' + + for PRD in $JB_PRODUCTS; do + rm -rf ~/Library/Preferences/${PRD}*/eval + rm -rf ~/Library/Application\ Support/${PRD}*/eval + done +elif [ $OS_NAME == "Linux" ]; then + echo 'Linux:' + + for PRD in $JB_PRODUCTS; do + rm -rf ~/.${PRD}*/config/eval + done +else + echo 'unsupport' + exit +fi + +echo 'done.' \ No newline at end of file diff --git a/scripts/temp_reset_eval_windows.vbs b/scripts/temp_reset_eval_windows.vbs new file mode 100644 index 0000000..9549cad --- /dev/null +++ b/scripts/temp_reset_eval_windows.vbs @@ -0,0 +1,34 @@ +Set oShell = CreateObject("WScript.Shell") +Set oFS = CreateObject("Scripting.FileSystemObject") +sHomeFolder = oShell.ExpandEnvironmentStrings("%USERPROFILE%") +sJBDataFolder = oShell.ExpandEnvironmentStrings("%APPDATA%") + "\JetBrains" + +Set re = New RegExp +re.Global = True +re.IgnoreCase = True +re.Pattern = "\.?(IntelliJIdea|GoLand|CLion|PyCharm|DataGrip|RubyMine|AppCode|PhpStorm|WebStorm|Rider).*" + +Sub removeEval(ByVal file, ByVal sEvalPath) + bMatch = re.Test(file.Name) + If Not bMatch Then + Exit Sub + End If + + If oFS.FolderExists(sEvalPath) Then + oFS.DeleteFolder sEvalPath, True + End If +End Sub + +If oFS.FolderExists(sHomeFolder) Then + For Each oFile In oFS.GetFolder(sHomeFolder).SubFolders + removeEval oFile, sHomeFolder + "\" + oFile.Name + "\config\eval" + Next +End If + +If oFS.FolderExists(sJBDataFolder) Then + For Each oFile In oFS.GetFolder(sJBDataFolder).SubFolders + removeEval oFile, sJBDataFolder + "\" + oFile.Name + "\eval" + Next +End If + +MsgBox "done" \ No newline at end of file