summaryrefslogtreecommitdiffstats
path: root/scripting/java/org/openoffice/netbeans/modules/office/utils
diff options
context:
space:
mode:
authorTomas O'Connor <toconnor@openoffice.org>2003-02-06 17:23:12 +0000
committerTomas O'Connor <toconnor@openoffice.org>2003-02-06 17:23:12 +0000
commitf9312c1be8369ae91d0504bae2918d5022d9287b (patch)
treeb6232de64461c6fa45605afad7c2264e680369d2 /scripting/java/org/openoffice/netbeans/modules/office/utils
parentAllow all languages to be resolved. (diff)
downloadcore-f9312c1be8369ae91d0504bae2918d5022d9287b.tar.gz
core-f9312c1be8369ae91d0504bae2918d5022d9287b.zip
Only strip off the part of the package declaration up to the Contents dir.
Diffstat (limited to 'scripting/java/org/openoffice/netbeans/modules/office/utils')
-rw-r--r--scripting/java/org/openoffice/netbeans/modules/office/utils/PackageRemover.java26
1 files changed, 21 insertions, 5 deletions
diff --git a/scripting/java/org/openoffice/netbeans/modules/office/utils/PackageRemover.java b/scripting/java/org/openoffice/netbeans/modules/office/utils/PackageRemover.java
index b80fe8fc956d..49ce1cba1a92 100644
--- a/scripting/java/org/openoffice/netbeans/modules/office/utils/PackageRemover.java
+++ b/scripting/java/org/openoffice/netbeans/modules/office/utils/PackageRemover.java
@@ -2,9 +2,9 @@
*
* $RCSfile: PackageRemover.java,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: toconnor $ $Date: 2002-11-13 17:44:39 $
+ * last change: $Author: toconnor $ $Date: 2003-02-06 18:23:12 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -82,9 +82,12 @@ public class PackageRemover {
String line;
while ((line = in.readLine()) != null) {
- if (line.startsWith("package") && line.indexOf(ParcelZipper.CONTENTS_DIRNAME) != -1) {
- // got package declaration, do not write it
- continue;
+ if (line.startsWith("package")) {
+ String newDeclaration = evaluate(line);
+ if (newDeclaration != null) {
+ out.write(newDeclaration, 0, newDeclaration.length());
+ out.newLine();
+ }
}
else {
out.write(line, 0, line.length());
@@ -108,6 +111,19 @@ public class PackageRemover {
tmp.renameTo(source);
}
+ public static String evaluate(String line) {
+
+ int idx = line.indexOf(ParcelZipper.CONTENTS_DIRNAME);
+ if (idx == -1)
+ return line;
+
+ idx = idx + ParcelZipper.CONTENTS_DIRNAME.length();
+ if (line.charAt(idx) == '.')
+ return "package " + line.substring(idx + 1);;
+
+ return null;
+ }
+
public static void main(String[] args) {
File source = new File(args[0]);