From 94fc5f01e8ad56d33732aa8b1c0f351f0e227b22 Mon Sep 17 00:00:00 2001 From: Kushal Munir < kmunir@ca.ibm.com> Date: Tue, 3 Oct 2006 04:54:24 +0000 Subject: [PATCH] Bug 158981: Local drives show up in lowercase --- .../local/files/LocalFileService.java | 64 +++++++++++-------- 1 file changed, 38 insertions(+), 26 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/services/local/files/LocalFileService.java b/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/services/local/files/LocalFileService.java index d784f0a205e..514264855cb 100644 --- a/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/services/local/files/LocalFileService.java +++ b/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/services/local/files/LocalFileService.java @@ -50,30 +50,30 @@ public class LocalFileService extends AbstractFileService implements IFileServic { private static final String[] ALLDRIVES = { - "c:\\", - "d:\\", - "e:\\", - "f:\\", - "g:\\", - "h:\\", - "i:\\", - "j:\\", - "k:\\", - "l:\\", - "m:\\", - "n:\\", - "o:\\", - "p:\\", - "q:\\", - "r:\\", - "s:\\", - "t:\\", - "u:\\", - "v:\\", - "w:\\", - "x:\\", - "y:\\", - "z:\\" }; + "C:\\", + "D:\\", + "E:\\", + "F:\\", + "G:\\", + "H:\\", + "I:\\", + "J:\\", + "K:\\", + "L:\\", + "M:\\", + "N:\\", + "O:\\", + "P:\\", + "Q:\\", + "R:\\", + "S:\\", + "T:\\", + "U:\\", + "V:\\", + "W:\\", + "X:\\", + "Y:\\", + "Z:\\" }; private boolean _checkedOS = false; private boolean _isWindows = false; @@ -576,9 +576,22 @@ public class LocalFileService extends AbstractFileService implements IFileServic protected IHostFile[] internalFetch(IProgressMonitor monitor, String remoteParent, String fileFilter, int type) { + LocalFileNameFilter fFilter = new LocalFileNameFilter(fileFilter); - + File localParent = new File(remoteParent); + + // if the system type is Windows, we get the canonical path so that we have the correct case in the path + // this is needed because Windows paths are case insensitive + if (isWindows()) { + + try { + localParent = localParent.getCanonicalFile(); + } + catch (IOException e) { + System.out.println("Can not get canonical path: " + localParent.getAbsolutePath()); + } + } if (remoteParent.endsWith(ArchiveHandlerManager.VIRTUAL_SEPARATOR)) { @@ -697,7 +710,6 @@ public class LocalFileService extends AbstractFileService implements IFileServic try { v.add(drive.getAbsoluteFile()); - //v.addElement(drive.getCanonicalFile()); } catch (Exception e) {