[openrtm-commit:02535] r707 - in trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder: . generator
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 3月 26日 (日) 22:23:19 JST
Author: ga
Date: 2017-03-26 22:23:18 +0900 (Sun, 26 Mar 2017)
New Revision: 707
Modified:
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/Generator.java
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/generator/GeneratedResult.java
Log:
Modified generated CMakeFile for Python #3992
Modified: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/Generator.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/Generator.java 2017-03-20 08:18:07 UTC (rev 706)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/Generator.java 2017-03-26 13:23:18 UTC (rev 707)
@@ -1,6 +1,7 @@
package jp.go.aist.rtm.rtcbuilder;
import java.io.BufferedWriter;
+import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -645,14 +646,18 @@
}
}
try {
- String strFullPath = outputFile.getLocation().toOSString();
- FileOutputStream fos = new FileOutputStream(strFullPath);
- fos.write(0xef); fos.write(0xbb); fos.write(0xbf);
- OutputStreamWriter osw = new OutputStreamWriter( fos , "UTF-8");
- BufferedWriter fp = new BufferedWriter( osw );
- fp.write ( generatedResult.getCode());
- fp.flush();
- fp.close();
+ if(generatedResult.getEncode().length()==0) {
+ String strFullPath = outputFile.getLocation().toOSString();
+ FileOutputStream fos = new FileOutputStream(strFullPath);
+ fos.write(0xef); fos.write(0xbb); fos.write(0xbf);
+ OutputStreamWriter osw = new OutputStreamWriter( fos , "UTF-8");
+ BufferedWriter fp = new BufferedWriter( osw );
+ fp.write ( generatedResult.getCode());
+ fp.flush();
+ fp.close();
+ } else {
+ outputFile.create(new ByteArrayInputStream(generatedResult.getCode().getBytes(generatedResult.getEncode())), false, null);
+ }
} catch (Exception e) {
LOGGER.error("Fail to create file", e);
}
Modified: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/generator/GeneratedResult.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/generator/GeneratedResult.java 2017-03-20 08:18:07 UTC (rev 706)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/generator/GeneratedResult.java 2017-03-26 13:23:18 UTC (rev 707)
@@ -6,6 +6,7 @@
public class GeneratedResult {
private String name;
private String code = "";
+ private String encode = "";
public GeneratedResult() {
this.name = "";
@@ -21,7 +22,6 @@
public String getCode() {
return code;
}
-
public void setCode(String code) {
this.code = code;
}
@@ -29,8 +29,14 @@
public String getName() {
return name;
}
-
public void setName(String name) {
this.name = name;
}
+
+ public String getEncode() {
+ return encode;
+ }
+ public void setEncode(String encode) {
+ this.encode = encode;
+ }
}
openrtm-commit メーリングリストの案内