reset completely

Signed-off-by: pengzhile <pengzhile@gmail.com>
This commit is contained in:
pengzhile
2020-07-01 15:17:07 +08:00
parent f7b3d92ce5
commit d1c6256b0d
4 changed files with 73 additions and 22 deletions
+5 -1
View File
@@ -1,5 +1,5 @@
#!/bin/bash
# reset jetbrains ide evals
# reset jetbrains ide evals v1.0.4
OS_NAME=$(uname -s)
JB_PRODUCTS="IntelliJIdea CLion PhpStorm GoLand PyCharm WebStorm Rider DataGrip RubyMine AppCode"
@@ -9,7 +9,9 @@ if [ "$OS_NAME" == "Darwin" ]; then
for PRD in $JB_PRODUCTS; do
rm -rf ~/Library/Preferences/"${PRD}"*/eval
sed -i '' '/name="evlsprt.*"/d' ~/Library/Preferences/"${PRD}"*/options/other.xml >/dev/null 2>&1
rm -rf ~/Library/Application\ Support/JetBrains/"${PRD}"*/eval
sed -i '' '/name="evlsprt.*"/d' ~/Library/Application\ Support/JetBrains/"${PRD}"*/options/other.xml >/dev/null 2>&1
done
plutil -remove "/.JetBrains\.UserIdOnMachine" ~/Library/Preferences/com.apple.java.util.prefs.plist >/dev/null
@@ -20,7 +22,9 @@ elif [ "$OS_NAME" == "Linux" ]; then
for PRD in $JB_PRODUCTS; do
rm -rf ~/."${PRD}"*/config/eval
sed -i '/name="evlsprt.*"/d' ~/."${PRD}"*/config/options/other.xml >/dev/null 2>&1
rm -rf ~/.config/JetBrains/"${PRD}"*/eval
sed -i '/name="evlsprt.*"/d' ~/.config/JetBrains/"${PRD}"*/options/other.xml >/dev/null 2>&1
done
sed -i '/key="JetBrains\.UserIdOnMachine"/d' ~/.java/.userPrefs/prefs.xml
+30 -12
View File
@@ -1,3 +1,4 @@
' reset jetbrains ide evals v1.0.4
Set oShell = CreateObject("WScript.Shell")
Set oFS = CreateObject("Scripting.FileSystemObject")
sHomeFolder = oShell.ExpandEnvironmentStrings("%USERPROFILE%")
@@ -9,26 +10,43 @@ 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)
bMatch = re.Test(file.Name)
If Not bMatch Then
Exit Sub
End If
Exit Sub
End If
If oFS.FolderExists(sEvalPath) Then
oFS.DeleteFolder sEvalPath, True
End If
If oFS.FolderExists(sEvalPath) Then
oFS.DeleteFolder sEvalPath, True
End If
content = ""
otherFile = oFS.GetParentFolderName(sEvalPath) + "\options\other.xml"
If oFS.FileExists(otherFile) Then
Set txtStream = oFS.OpenTextFile(otherFile, 1, False)
Do While Not txtStream.AtEndOfStream
line = txtStream.ReadLine
If InStr(line, "name=""evlsprt") = 0 Then
content = content + line + vbLf
End If
Loop
txtStream.Close
Set txtStream = oFS.OpenTextFile(otherFile, 2, False)
txtStream.Write content
txtStream.Close
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
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
For Each oFile In oFS.GetFolder(sJBDataFolder).SubFolders
removeEval oFile, sJBDataFolder + "\" + oFile.Name + "\eval"
Next
End If
On Error Resume Next