swc-windows-installer.py: Use '~' in ~/nano.rc includes
[swc-setup-windows-installer.git] / swc-windows-installer.py
index 440a9ab51afe38156a829c486f9e0852c261106a..fe7af74dc114e6af7e998a574700d95d3ba334b4 100755 (executable)
@@ -123,14 +123,17 @@ def install_nanorc(install_directory):
         sha1='f2a628394f8dda1b9f28c7e7b89ccb9a6dbd302a',
         install_directory=install_directory,
         strip_components=1)
-    nanorc = os.path.join(os.path.expanduser('~'), 'nano.rc')
+    home = os.path.expanduser('~')
+    nanorc = os.path.join(home, 'nano.rc')
     if not os.path.isfile(nanorc):
         syntax_dir = os.path.join(install_directory, 'doc', 'syntax')
         with open(nanorc, 'w') as f:
             for filename in os.listdir(syntax_dir):
                 if filename.endswith('.nanorc'):
                     path = os.path.join(syntax_dir, filename)
-                    f.write('include {}\n'.format(path))
+                    rel_path = os.path.relpath(path, home)
+                    include_path = os.path.join('~', rel_path)
+                    f.write('include {}\n'.format(include_path))
 
 
 def create_nosetests_entry_point(python_scripts_directory):