Changeset 26819 in osm


Ignore:
Timestamp:
2011-10-09T22:30:02+02:00 (13 years ago)
Author:
oliverw
Message:

Fixed #6907 (Error reading audio files from case sensitive filesystem).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/ColumbusCSV/src/org/openstreetmap/josm/plugins/columbusCSV/ColumbusCSVReader.java

    r25551 r26819  
    365365                String voxFile = null;
    366366                if (isExtMode) {
    367                         voxFile = csvLine[14].toLowerCase();
     367                        voxFile = csvLine[14];
    368368                } else {
    369                         voxFile = csvLine[9].toLowerCase();
     369                        voxFile = csvLine[9];
    370370                }
    371371
    372372                if (!ColumbusCSVUtils.isStringNullOrEmpty(voxFile)) {
    373373                        File file = getVoxFilePath(fileDir, voxFile);
    374                         if (file.exists()) {
     374                        if (file != null && file.exists()) {
     375                                // link vox file
    375376                                int voxNum = getNumberOfVoxfile(voxFile);
    376377                                lastVoxNumber = Math.max(voxNum, lastVoxNumber);
     
    447448         */
    448449        public File getVoxFilePath(String fileDir, String voxFile) {
    449                 File file = new File(fileDir + File.separator + voxFile + ".wav");
    450                 return file;
     450                // The FAT16 file name is interpreted differently from case-sensitive file systems, so we
     451                // have to test several variants
     452                String[] fileNameVariants = new String[] {voxFile, voxFile.toLowerCase(), voxFile.toUpperCase()};
     453               
     454                for (int i = 0; i < fileNameVariants.length; i++) {
     455                        File file = new File(fileDir + File.separator + fileNameVariants[i] + ".wav");
     456                        if (file.exists()) {
     457                                return file;
     458                        }
     459                }
     460                return null; // give up...
     461               
    451462        }
    452463
Note: See TracChangeset for help on using the changeset viewer.