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
|
raise
|
||||||
|
|
||||||
|
|
||||||
|
def is_symlink(path):
|
||||||
|
try:
|
||||||
|
return os.is_symlink(path)
|
||||||
|
except:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def createSymlink():
|
def createSymlink():
|
||||||
|
link = os.path.join(RESOURCES_FOLDER, 'wakatime-cli')
|
||||||
if is_win:
|
if is_win:
|
||||||
link = os.path.join(RESOURCES_FOLDER, 'wakatime-cli.exe')
|
link = link + '.exe'
|
||||||
if os.path.exists(link):
|
elif os.path.exists(link) and is_symlink(link):
|
||||||
try:
|
return # don't re-create symlink on Unix-like platforms
|
||||||
os.remove(link)
|
|
||||||
except:
|
try:
|
||||||
log(traceback.format_exc())
|
os.symlink(getCliLocation(), link)
|
||||||
|
except:
|
||||||
try:
|
try:
|
||||||
shutil.copy2(getCliLocation(), link)
|
shutil.copy2(getCliLocation(), link)
|
||||||
except:
|
except:
|
||||||
log(traceback.format_exc())
|
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