swc-windows-installer.py: Use POSIX paths for ~/nano.rc
authorW. Trevor King <wking@tremily.us>
Thu, 13 Mar 2014 02:21:57 +0000 (19:21 -0700)
committerW. Trevor King <wking@tremily.us>
Thu, 13 Mar 2014 02:21:57 +0000 (19:21 -0700)
On Wed, Mar 12, 2014 at 06:34:43PM -0700, Ethan White wrote [1]:
> The bash script in #228 is now working properly, but the Python
> script is still failing. It reports errors like:
>
>     Error reading ~\.swc\share\nanorc\doc\syntax\python.nanorc
>
> The obvious difference is that the nano.rc files produced by the
> bash script have `/` for paths for the includes, but the Python
> script produces includes that use `\`.

[1]: https://github.com/swcarpentry/bc/pull/357#issuecomment-37491038

swc-windows-installer.py

index fe7af74dc114e6af7e998a574700d95d3ba334b4..3fee89343a4ff061343e683bf80c90661e81e94b 100755 (executable)
@@ -132,7 +132,7 @@ def install_nanorc(install_directory):
                 if filename.endswith('.nanorc'):
                     path = os.path.join(syntax_dir, filename)
                     rel_path = os.path.relpath(path, home)
-                    include_path = os.path.join('~', rel_path)
+                    include_path = make_posix_path(os.path.join('~', rel_path))
                     f.write('include {}\n'.format(include_path))