[Laszlo-checkins] r16771 - openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler
hqm@openlaszlo.org
hqm at openlaszlo.org
Tue Jun 22 11:27:10 PDT 2010
Author: hqm
Date: 2010-06-22 11:27:08 -0700 (Tue, 22 Jun 2010)
New Revision: 16771
Modified:
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/LibraryWriter.java
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/SWF9Writer.java
Log:
Change 20100622-hqm-V by hqm at new-host-4.home on 2010-06-22 13:32:12 EDT
in /Users/hqm/openlaszlo/trunk3
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: fix for lzo pathname bug on windows
New Features:
Bugs Fixed: LPP-9141 cannot compile a .lzo for swf10 on Windows which depends on external include
Technical Reviewer: ptw
QA Reviewer: (pending)
Doc Reviewer: (pending)
Documentation:
Release Notes:
Overview:
Details:
SWF9Writer.java:
When building an application, if the compiler encounters any swf10
.swc files in any lzo's it is using, it copies the .swc files out to
the temp build directory so that the flex compiler can see them. In
this case, it was constructing a poorly formed pathname, which caused
an IO error.
This fix uses the "safe name" code from the LibraryWriter, to
construct the tmp pathname to place the .swc, so that is has no
special filesystem chars in it.
Tests:
In Windows XP, compile these lzo library files. The compile of lib2.lzx is where the error would
happen, because it references an external lzo library which needs to be unpacked by the compiler
and copied to the build directory.
cd test\testlzo
set LPS_HOME=Z:\openlaszlo\trunk3
set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_17
call %LPS_HOME%\WEB-INF\lps\server\bin\lzc.bat "-DJAVA_HOME=%JAVA_HOME%" "-DLPS_HOME=%LPS_HOME%" "-Dnodeploy" "-Dlzproxied=false" "--runtime=swf10" -c --runtime=swf10 extclass.lzx
call %LPS_HOME%\WEB-INF\lps\server\bin\lzc.bat "-DJAVA_HOME=%JAVA_HOME%" "-DLPS_HOME=%LPS_HOME%" "-Dnodeploy" "-Dlzproxied=false" "--runtime=swf10" -c --runtime=swf10 libdir/lib2.lzx
^^^^^^ This is the place an error would occur
call %LPS_HOME%\WEB-INF\lps\server\bin\lzc.bat "-DJAVA_HOME=%JAVA_HOME%" "-DLPS_HOME=%LPS_HOME%" "-Dnodeploy" "-Dlzproxied=false" "--runtime=swf10" --runtime=swf10 main.lzx
Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/LibraryWriter.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/LibraryWriter.java 2010-06-22 17:43:03 UTC (rev 16770)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/LibraryWriter.java 2010-06-22 18:27:08 UTC (rev 16771)
@@ -109,7 +109,7 @@
}
}
- public static String makeLZOClassname(File appfile) {
+ public static String fileToSymbol(File appfile) {
try {
String lzoAbsPath = appfile.getCanonicalPath();
lzoAbsPath = lzoAbsPath.substring(0,lzoAbsPath.length()-4);
@@ -151,7 +151,7 @@
public void open(String compileType) {
CompilerMediaCache mcache = mEnv.getMediaCache();
if (mSWF10Writer != null) {
- String safename = makeLZOClassname(mEnv.getApplicationFile());
+ String safename = fileToSymbol(mEnv.getApplicationFile());
mSWF10Writer.mAppMainClassname = safename;
mSWF10Writer.mAppPreamble = makeLZOPreamble(safename);
Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/SWF9Writer.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/SWF9Writer.java 2010-06-22 17:43:03 UTC (rev 16770)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/SWF9Writer.java 2010-06-22 18:27:08 UTC (rev 16771)
@@ -508,7 +508,7 @@
File lzo = new File((String)e.next());
// Add in a top level all in the main app to invoke the lzo
// lib's runtToplevel Definitions method
- addScript("(new "+ LibraryWriter.makeLZOClassname(lzo)+"()).runToplevelDefinitions();\n");
+ addScript("(new "+ LibraryWriter.fileToSymbol(lzo)+"()).runToplevelDefinitions();\n");
}
@@ -594,12 +594,11 @@
}
}
}
- File dirfile = mEnv.getApplicationFile().getParentFile();
- File appdir = dirfile != null ? dirfile : new File(".");
- String relPath = FileUtils.relativePath(lzofile, appdir);
- String fprefix = relPath.replace(File.separator, "_");
+ String fprefix = LibraryWriter.fileToSymbol(lzofile);
+
//System.err.println("lzo pathname prefix = "+fprefix);
File swc = new File(workdir, fprefix + ".swc");
+
FileUtils.send(zis, new FileOutputStream(swc));
zis.close();
//System.err.println("swc file copied to "+swc);
More information about the Laszlo-checkins
mailing list