I tried minifying the code and following error occur:
openfl build html5 -minify
Called from ? line 1
Called from CommandLineTools.hx line 1330
Called from CommandLineTools.hx line 25
Called from a C function
Called from CommandLineTools.hx line 126
Called from CommandLineTools.hx line 567
Called from project/PlatformTarget.hx line 77
Called from platforms/HTML5Platform.hx line 61
Called from helpers/HTML5Helper.hx line 176
Called from /usr/lib/haxe/std/neko/_std/sys/FileSystem.hx line 38
Uncaught exception - std@sys_rename
Do i have to install something before compiling minified. Its happening in following command as well:
But I did a little digging and found that for some reason rename from /tmp to a file in /home doesn’t work (linux).
If I change PathHelper.getTemporaryFile to use the current working directory instead of /tmp then it works.
It’s not a permission issue, I can mv it without any problem.
It’s only a quick and dirty fix, the root cause of the problem will have to be found.
But in the meantime you can edit the file /usr/lib/haxe/lib/lime/2,1,1/lime/tools/helper/PathHelper.hx (or another version but line number may vary a little) line 334, inside the getTemporaryFile function.
replace path += "/temp_" + Math.round (0xFFFFFF * Math.random ()) + extension;
with path = Sys.getCwd() + "/temp_" + Math.round (0xFFFFFF * Math.random ()) + extension;
Then do a lime rebuild tools.
This works for me, hopefuly it’ll work for you too.
What OS and version are you using? What are the permissions of your temp directory? I’ve used Ubuntu with this, fine (I think since changing the closure version as well) but it could be different folder permissions, or maybe a difference between Oracle Java 7 and another replacement for Java
I’m using OpenSuse 13.2 and my temp directory is 1777.
// Doesn't work (used by lime tool after the closure compiler has finished)
sys.FileSystem.rename("/tmp/temp_4766286.js", "/home/ibilon/test.js");
// Work
Sys.command("mv", ["/tmp/temp_4766286.js", "/home/ibilon/test.js"]);
// Work
sys.io.File.copy("/tmp/temp_4766286.js", "/home/ibilon/test.js");
sys.FileSystem.deleteFile("/tmp/temp_4766286.js");
I have no idea how FileSystem.rename work (I’ll look) but that does sound like a bug.
Okay, great, that last sample seems best – we copy it over, then remove our temporary file. Would you mind doing a pull for this? We don’t have to understand all mysteries if we get it working anyway