From 9cc8cf11356cc58a26b651e4b709b2992e0ca567 Mon Sep 17 00:00:00 2001
From: "Jan T. Sott" <jan@idleberg.com>
Date: Wed, 20 Apr 2016 12:43:46 +0200
Subject: [PATCH] use join()

---
 chmod.py | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/chmod.py b/chmod.py
index 8c76bae..16b41fa 100644
--- a/chmod.py
+++ b/chmod.py
@@ -8,18 +8,16 @@
 ]
 
 def plugin_loaded():
+    from os.path import join
     from package_control import events
-    
-    # Get name of package folder
-    me = os.path.basename(os.path.dirname(os.path.realpath(__file__)))
 
-    if (events.install(me) or events.post_upgrade(me)) and os.name is 'posix' or 'mac':
+    if (events.install(package) or events.post_upgrade(package)) and os.name is 'posix' or 'mac':
         for file in files:
 
             # Concat full path
-            file_path = sublime.packages_path() + '/' + me + '/' + file
+            f = join(sublime.packages_path(), package + '/' + file)
 
             # Change permissions, if file exists
-            if os.path.isfile(file_path):
-                st = os.stat(file_path)
-                os.chmod(file_path, st.st_mode | stat.S_IEXEC)
\ No newline at end of file
+            if os.path.isfile(f):
+                st = os.stat(f)
+                os.chmod(f, st.st_mode | stat.S_IEXEC)