Skip to content

Commit 88855cb

Browse files
committed
File.separator not useful for cygwin
1 parent aa29c45 commit 88855cb

6 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/g2html/Config.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public static void load(String[] args) {
7272

7373
// returns the input dot file for a given C file, and function
7474
public static File getFunDotFile(String path, String fun) {
75-
path = path.replaceAll(Pattern.quote(File.separator),"%2F");
75+
path = path.replaceAll("/", "%2F");
7676
File f = new File(new File(new File(conf.getCfgDir()), path), fun + ".dot");
7777
return f;
7878
}

src/g2html/Loc.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ static public void parseLocNode(XMLStreamReader parser, Result res, ResultStats
1818
String id = parser.getAttributeValue("", "id");
1919

2020
// compute the file-id from the full path
21-
String shortFile = file.replaceAll(Pattern.quote(File.separator),"%2F");
21+
String shortFile = file.replaceAll("/", "%2F");
2222

2323
// look up the database for the file
2424
FileStats fileStats = resultStats.getStats(shortFile);

src/g2html/Result.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ private static void copyFromJar(String f,File t) throws IOException{
7373

7474
// generic file copy
7575
public static void copyFile( File from, File to ) throws IOException {
76+
System.out.printf("copy resource from '%s' to '%s'\n", from, to);
7677
if ( !to.exists() ) { to.createNewFile(); }
7778

7879
try (
@@ -85,13 +86,12 @@ public static void copyFile( File from, File to ) throws IOException {
8586

8687
// copy a file either form the jar or from a special resources directory
8788
public static void copyResource(String f, File to) throws IOException {
88-
String basePath = File.separator + "resources" + File.separator;
8989
try {
9090
/* try jar first ... */
91-
copyFromJar(basePath + f, to);
91+
copyFromJar("/resources/" + f, to);
9292
} catch (IOException e){
9393
/* .. no? This means that we are debugging in an IDE? */
94-
copyFile(new File(".."+basePath+f), to);
94+
copyFile(new File(".."+File.separator + "resources" + File.separator+f), to);
9595
}
9696
}
9797

@@ -105,7 +105,7 @@ public Result(String resDir) throws IOException {
105105

106106
// return a listing file to be created
107107
public File getListingFile(String path) {
108-
path = path.replaceAll(Pattern.quote(File.separator),"%2F");
108+
path = path.replaceAll("/","%2F");
109109
File f = new File(filDir, path+".xml");
110110
return f;
111111
}

src/g2html/ResultStats.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void printReport(Result r)
5959
continue;
6060
// write the file-name
6161
report.writeStartElement("file");
62-
report.writeAttribute("name", file.replaceAll("%2F", Matcher.quoteReplacement(File.separator)));
62+
report.writeAttribute("name", file.replaceAll("%2F", "/"));
6363

6464
// for each function
6565
for (String fun : fm.get(file).getFunctions()){

src/g2html/Structure.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public static void parseFileNode(XMLStreamReader parser, ResultStats resultStats
1414
throws XMLStreamException {
1515

1616
// get basic information
17-
String name = parser.getAttributeValue("", "path").replaceAll(Pattern.quote(File.separator),"%2F");;
17+
String name = parser.getAttributeValue("", "path").replaceAll("/", "%2F");;
1818
String fun = "";
1919

2020
// parse the file and

src/g2html/Warning.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static public void parseWarningNode(XMLStreamReader parser, Result res, ResultSt
4444
readcc.getLocalName()=="text"){
4545
String path = readcc.getAttributeValue("","file");
4646
String line = readcc.getAttributeValue("","line");
47-
String shortFile = path.replaceAll(Pattern.quote(File.separator),"%2F");;
47+
String shortFile = path.replaceAll("/", "%2F");
4848

4949
resultStats.getStats(shortFile).addWarning(id,Integer.valueOf(line));
5050
}

0 commit comments

Comments
 (0)