Skip to content

Commit

Permalink
Ensure we're cloning the right file
Browse files Browse the repository at this point in the history
  • Loading branch information
mottosso committed Jan 22, 2021
1 parent ec5c62b commit c53210e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cmdx.py
Original file line number Diff line number Diff line change
Expand Up @@ -5880,8 +5880,12 @@ def install():
tempdir = tempfile.gettempdir()
tempfname = os.path.join(tempdir, unique_plugin)

# Rename ourselves..
shutil.copy(__file__, tempfname)
# We can't know whether we're a .pyc or .py file,
# but we need to copy the .py file *only*
fname = os.path.splitext(__file__)[0] + ".py"

# Copy *and overwrite*
shutil.copy(fname, tempfname)

# Now we're guaranteed to not interfere
# with other versions of cmdx. Win!
Expand Down

0 comments on commit c53210e

Please sign in to comment.