Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File not found when use absolute path #321

Open
moonknight37 opened this issue Feb 12, 2019 · 2 comments
Open

File not found when use absolute path #321

moonknight37 opened this issue Feb 12, 2019 · 2 comments

Comments

@moonknight37
Copy link

I tried to use the compressor as "java -jar E:/yuicompressor-2.4.8.jar --type js --charset UTF-8 E:/tmp/src/my.js -o E:/tmp/src/my.min.js" . When run the command, I got an error like "java.io.FileNotFoundException: \tmp\src\my.min.js:\tmp\src\my.js". The full stack is:
java.io.FileNotFoundException: \tmp\src\my.min.js:\tmp\src\my.js
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.(FileOutputStream.java:213)
at java.io.FileOutputStream.(FileOutputStream.java:101)
at com.yahoo.platform.yui.compressor.YUICompressor.main(YUICompressor.java:204)

@moonknight37
Copy link
Author

I found a comment in class named YUICompressor, line number 159. Code is:
// if a substitution pattern was passed in
if (pattern.length > 1 && files.size() > 0) {
outputFilename = inputFilename.replaceFirst(pattern[0], pattern[1]);
}
The code block replaced the absolute path .

@TimLethbridge
Copy link

The workaround is to send the output to standard output and redirect it to a file. We had this problem and it worked for us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants