Windows compatibility #6

Closed
i-akhmadullin opened this Issue Jul 24, 2012 · 1 comment

Comments

Projects
None yet
2 participants
Contributor

i-akhmadullin commented Jul 24, 2012

On windows plugin doesn't compress images because of this line helper.js:

fileOutput = path.normalize(dest + normalizedFile.substr(normalizedFile.indexOf('/'))),

on windows paths delimiter is backward slash \ so plugin incorrectly creates only one file with extension g and no filename in specified directory.

Quick fix is probably this:

fileOutput = path.normalize(dest + normalizedFile.substr(normalizedFile.indexOf(path.sep))),

only problem is that path.sep exists only in Node-0.7.9 and up.

Other and better supported way to fix is probably like this:

isWindows = process.platform === 'win32';
pathSeparator = isWindows ? '\\' : '/';
fileOutput = path.normalize(dest + normalizedFile.substr(normalizedFile.indexOf(pathSeparator))),

or maybe there is better way to fix this issue.

Anyway thanks for this really useful plugin.

Owner

asciidisco commented Jul 25, 2012

Hi,

thanks for your investigation & help.
Could you please send me a pull request?
That would be awesome.

Regards

@asciidisco asciidisco closed this in 6d5222d Aug 2, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment