Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make sure picker binary is executable

Plugin file permissions is reset when installing with sublime package manager
  • Loading branch information...
commit 4ba36449e94cbaf91a5c870f341c3ed672c484d4 1 parent 890752c
@jnordberg authored
Showing with 7 additions and 3 deletions.
  1. +7 −3 ColorPick.py
View
10 ColorPick.py
@@ -1,8 +1,9 @@
import sublime
import sublime_plugin
import subprocess
-from os import path
+import os
+picker_path = os.path.join(sublime.packages_path(), 'ColorPick', 'bin', 'colorpick')
def is_valid_hex_color(s):
if len(s) not in (3, 6):
@@ -12,13 +13,16 @@ def is_valid_hex_color(s):
except ValueError:
return False
-
class ColorPickCommand(sublime_plugin.TextCommand):
def run(self, edit):
view = self.view
sel = view.sel()
start_color = None
+ # make sure color picker binary is executable
+ if not os.access(picker_path, os.X_OK):
+ os.chmod(picker_path, 0755)
+
# get the currently selected color - if any
if len(sel) > 0:
selected = view.substr(view.word(sel[0])).strip()
@@ -29,7 +33,7 @@ def run(self, edit):
start_color = selected
# get new color from picker
- args = [path.join(sublime.packages_path(), 'ColorPick', 'bin', 'colorpick')]
+ args = [picker_path]
if start_color:
args.append('-startColor')
args.append(start_color)
Please sign in to comment.
Something went wrong with that request. Please try again.