mirror of
https://github.com/wakatime/sublime-wakatime.git
synced 2023-08-10 21:13:02 +03:00
Copy wakatime-cli when symlink fails
This commit is contained in:
parent
66f5f48f33
commit
7d2bd0b7c5
28
WakaTime.py
28
WakaTime.py
@ -908,22 +908,24 @@ def download(url, filePath):
|
||||
raise
|
||||
|
||||
|
||||
def createSymlink():
|
||||
if is_win:
|
||||
link = os.path.join(RESOURCES_FOLDER, 'wakatime-cli.exe')
|
||||
if os.path.exists(link):
|
||||
def is_symlink(path):
|
||||
try:
|
||||
os.remove(link)
|
||||
return os.is_symlink(path)
|
||||
except:
|
||||
return False
|
||||
|
||||
|
||||
def createSymlink():
|
||||
link = os.path.join(RESOURCES_FOLDER, 'wakatime-cli')
|
||||
if is_win:
|
||||
link = link + '.exe'
|
||||
elif os.path.exists(link) and is_symlink(link):
|
||||
return # don't re-create symlink on Unix-like platforms
|
||||
|
||||
try:
|
||||
os.symlink(getCliLocation(), link)
|
||||
except:
|
||||
log(traceback.format_exc())
|
||||
try:
|
||||
shutil.copy2(getCliLocation(), link)
|
||||
except:
|
||||
log(traceback.format_exc())
|
||||
else:
|
||||
link = os.path.join(RESOURCES_FOLDER, 'wakatime-cli')
|
||||
if not os.path.exists(link):
|
||||
try:
|
||||
os.symlink(getCliLocation(), link)
|
||||
except:
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user