Commit 1b0c3638 authored by Andrew Shark's avatar Andrew Shark
Browse files

fix incorrect name replacement

parent bf4a0bd0
......@@ -7,12 +7,13 @@
# In Run/Debug configuration called "current:" (here name is important (not just for your use), it should start with curr.):
# In External Tool create tool named "update current script path":
# Program: point to this file (pycharm-scripts/update_current_script_path.sh)
# Arguments: "$ModuleFileDir$" "$FilePathRelativeToProjectRoot$"
# Arguments: "$ModuleFileDir$" "$FileDirRelativeToProjectRoot$" "$FileName$"
# Working directory: $FileDir$
# Do not forget to add created tool (update current script path) to the Before launch list.
idea_dir="$1"
cur_file_from_project="$2"
filedir_from_project_root="$2"
filename="$3"
if [ ! -d "$idea_dir" ]; then
echo "idea directory does not exist" >&2
......@@ -22,7 +23,6 @@ elif [ ! -f "$idea_dir/workspace.xml" ]; then
exit 1
fi
filename=$(basename -- "$cur_file_from_project")
extension="${filename##*.}"
filebase="${filename%.*}"
......@@ -38,7 +38,7 @@ fi
echo ready
oldval=$(xmlstarlet sel --encode utf-8 -t -v "project/component[@name='RunManager']/configuration[starts-with(@name, 'curr')]/option[@name='SCRIPT_NAME']/@value" "$idea_dir/workspace.xml")
newval='$PROJECT_DIR$'/"$cur_file_from_project"
newval='$PROJECT_DIR$'/"$filedir_from_project_root/$filename"
echo "Setting new value: $newval"
# xmlstarlet ed --inplace -u "project/component[@name='RunManager']/configuration[@name='current opened py']/option[@name='SCRIPT_NAME']/@value" -v "$newval" "$idea_dir/workspace.xml" # If you want to hardcode the config name.
xmlstarlet ed --inplace -u "project/component[@name='RunManager']/configuration[starts-with(@name, 'curr')]/option[@name='SCRIPT_NAME']/@value" -v "$newval" "$idea_dir/workspace.xml"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment