sass/libsass — pull request #451 by mgreter (2014-07-26 05:46:52+00:00)
Title: Problem with relative path on windows and source maps

This is related to #441 and #242

Source Maps currently contain invalid paths:
```
"sources": ["../../../../../D:\github\webmerge\example\scss\_QfHU8qB_K.scss" ]
```

I tracked down the cultprit (as did #441) to be in `resolve_relative_path`. But IMO the underlying problem is burried deeper in the code at [context.cpp#L288](https://github.com/mgreter/libsass/blob/source_maps_win_rel_paths/context.cpp#L288). `resolve_relative_path` is called with `real_path` from `resolve_and_load` (uri), `source_map_file` (base) and `cwd` (cwd) ([file.cpp#L85](https://github.com/mgreter/libsass/blob/source_maps_win_rel_paths/file.cpp#L85)):
```
uri: D:\github\webmerge\example\scss\4CTIC43Arz.scss
base: test.map
cwd: D:/github/webmerge/example/scss/
absolute_uri: D:\github\webmerge\example\scss\4CTIC43Arz.scss
absolute_base: D:/github/webmerge/example/scss/test.map
=> ../../../../../D:\github\webmerge\example\scss\4CTIC43Arz.scss
```

I also have done some additional tests for when `resolve_relative_path` is called with a base on a different drive. It will then return a full windows path with forward slashes (which is acceptable IMO).
```
D:/github/webmerge/example/scss/4CTIC43Arz.scss
```

I don't know why #441 wants to actually convert paths on windows to lowercase. I think this would lead to all paths in source maps to be in lowercase. Which would introduce problems if these files would be deployed to linux or any other case sensitive fs.

It also fixes #242 since it should now always produce forward slashes, which do not need to be escaped. Although [source_map.cpp#L14](https://github.com/mgreter/libsass/blob/source_maps_win_rel_paths/source_map.cpp#L14) definitely should use some proper escaping.