diff options
Diffstat (limited to 'charm')
-rw-r--r-- | charm | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -10,8 +10,8 @@ import time # see com.intellij.idea.SocketLock for the server side of this interface RUN_PATH = u'/opt/pycharm-professional/bin/pycharm.sh' -CONFIG_PATH = u'~/.PyCharm2018.1/config' -SYSTEM_PATH = u'~/.PyCharm2018.1/system' +CONFIG_PATH = u'~/.PyCharm2018.2/config' +SYSTEM_PATH = u'~/.PyCharm2018.2/system' def print_usage(cmd): @@ -58,10 +58,13 @@ def try_activate_instance(args): if not (os.path.exists(port_path) and os.path.exists(token_path)): return False - with open(port_path) as pf: - port = int(pf.read()) - with open(token_path) as tf: - token = tf.read() + try: + with open(port_path) as pf: + port = int(pf.read()) + with open(token_path) as tf: + token = tf.read() + except (ValueError): + return False s = socket.socket() s.settimeout(0.3) @@ -96,7 +99,7 @@ def start_new_instance(args): if sys.platform == 'darwin': if len(args) > 0: args.insert(0, '--args') - os.execvp('open', ['-a', RUN_PATH] + args) + os.execvp('/usr/bin/open', ['-a', RUN_PATH] + args) else: bin_file = os.path.split(RUN_PATH)[1] os.execv(RUN_PATH, [bin_file] + args) |