Display source file paths in localised (windows) format

Description

When the source loader complains at issues in source files, it displays the file path in a unix (ish) style, such as:

SEVERE WARNING: Duplicate object name: Elf (Drow)
Orignal: file:/D:/utils/PCGen/PCGen51710/data/d20ogl/srd35/monsters/rsrd_races_e_f.lst

While such a display is perfect on linux, I am (regrettably, and still not completely sure why) still using windows XP.

Could the file paths be displayed in a format appropriate to the local OS, ie for windows show as D:\utils\blah rather than /D:/Utils/blah so it can be copied pasted to easily edit/view the appropriate file

I wont also ask for it to be a clickable link to automatically load into the default editor... or will I?

Environment

None

Activity

Show:
James Dempsey
April 16, 2013, 1:49 AM

This could be resolved using getCanonicalPath() on the file when it is displayed.

James Dempsey
June 20, 2013, 12:40 AM

Mark, thanks for your patch for this bug. I applied it and had a play - I think the file splitting code needs a bit more work as it wasn't able to handle log entries such as the sample below. However the code to locate the line and open the found file works quite nicely on Windows 7.

07:17:59.505 SEVERE Thread-6 LstFileLoader:167 ERROR:file:/D:/Users/James/Documents/pcgen/vendordata/james/Pathfinder/ultimate_equipment/pfue_equipmods_base.lst
Exception type:java.io.FileNotFoundException
Message\:D:\Users\James\Documents\pcgen\vendordata\james\Pathfinder\ultimate_equipment\pfue_equipmods_base.lst (The system cannot find the file specified)
07:18:03.566 SEVERE Thread-6 AbstractReferenceManufacturer:930 More than one ArmorProf with key/name Do-Maru was built
07:18:03.566 SEVERE Thread-6 AbstractReferenceManufacturer:940 Sources: file:/D:/Projects/pcgendev/data/d20ogl/paizo/pathfinder_rpg/ultimate_combat/pfuc_profs_armor.lst, file:/D:/Users/James/Documents/pcgen/vendordata/james/Pathfinder/ultimate_equipment/pfue_profs_armor.lst

Specific suggested changes:

  • To handle the file references starting as "file:" you may need to create a URI and then make a file based on that.

  • I think commas might need to be added as separators.

  • For some log messages, like the first one the best route may be to adjust the original message to make it easier to parse the file, i.e. make sure file names have white space around them. This is something that can be done over time rather than an exhaustive search.

  • The code formatting needs a slight adjustment to meet our standards - mostly the braces should be on their own line. We have an eclipse formatting rule set at code/standards/eclipse32_pcgen.xml which might be helpful here.

Mark Schrijver
June 29, 2013, 12:11 PM

I fixed the code style issues. I also tried to remedie the issues you had with those specific filename constructs. I tested it by putting the line you gave in your example straight into the code, and it converted it to the correct filename.
Could you give it another go? I committed it to the new SVN.

James Dempsey
June 30, 2013, 5:04 AM

Unfortunately you have used the wrong formatting rules and have actually reformatted the entire file away from the standard. That has made it quite hard pick what you actually changed.

The file translation is still not working on windows. I do recommend using the URI approach as that is what is being output in the log, hence why the use of File.separator has not helped.

Assignee

Mark Schrijver

Reporter

Dave Griffin

Labels

None

Theme

None

Epic/Theme

None

Pending User Input

None

Affects versions

Priority

Minor
Configure