Lines 287-296
Link Here
|
287 |
private FileFilter actualFileFilter = null; |
287 |
private FileFilter actualFileFilter = null; |
288 |
private GlobFilter globFilter = null; |
288 |
private GlobFilter globFilter = null; |
289 |
|
289 |
|
|
|
290 |
private final char fileSeparatorChar; |
291 |
|
290 |
public FileChooserUIImpl(FileChooserBuilder.JFileChooserEx filechooser) { |
292 |
public FileChooserUIImpl(FileChooserBuilder.JFileChooserEx filechooser) { |
291 |
super(filechooser); |
293 |
super(filechooser); |
292 |
approveSelectionAction = new ApproveSelectionAction(); |
294 |
approveSelectionAction = new ApproveSelectionAction(); |
293 |
cancelSelectionAction = new CancelSelectionAction(); |
295 |
cancelSelectionAction = new CancelSelectionAction(); |
|
|
296 |
fileSeparatorChar = filechooser.getFileSeparatorChar(); |
294 |
} |
297 |
} |
295 |
|
298 |
|
296 |
@Override |
299 |
@Override |
Lines 1140-1146
Link Here
|
1140 |
private void updateCompletions() { |
1143 |
private void updateCompletions() { |
1141 |
if (showPopupCompletion) { |
1144 |
if (showPopupCompletion) { |
1142 |
final String name = normalizeFile(getFileName()); |
1145 |
final String name = normalizeFile(getFileName()); |
1143 |
int slash = name.lastIndexOf(File.separatorChar); |
1146 |
int slash = name.lastIndexOf(fileSeparatorChar); |
1144 |
if (slash != -1) { |
1147 |
if (slash != -1) { |
1145 |
String prefix = name.substring(0, slash + 1); |
1148 |
String prefix = name.substring(0, slash + 1); |
1146 |
File[] children; |
1149 |
File[] children; |
Lines 1238-1244
Link Here
|
1238 |
} |
1241 |
} |
1239 |
|
1242 |
|
1240 |
|
1243 |
|
1241 |
private static String normalizeFile(String text) { |
1244 |
private String normalizeFile(String text) { |
1242 |
// See #21690 for background. |
1245 |
// See #21690 for background. |
1243 |
// XXX what are legal chars for var names? bash manual says only: |
1246 |
// XXX what are legal chars for var names? bash manual says only: |
1244 |
// "The braces are required when PARAMETER [...] is followed by a |
1247 |
// "The braces are required when PARAMETER [...] is followed by a |
Lines 1257-1265
Link Here
|
1257 |
text = text.substring(0, m.end(1)) + var + text.substring(m.end(2)); |
1260 |
text = text.substring(0, m.end(1)) + var + text.substring(m.end(2)); |
1258 |
} |
1261 |
} |
1259 |
if (text.equals("~")) {//NOI18N |
1262 |
if (text.equals("~")) {//NOI18N |
1260 |
return System.getProperty("user.home");//NOI18N |
1263 |
return fileChooser.getHomePath(); //NOI18N |
1261 |
} else if (text.startsWith("~" + File.separatorChar)) {//NOI18N |
1264 |
} else if (text.startsWith("~" + fileSeparatorChar)) {//NOI18N |
1262 |
return System.getProperty("user.home") + text.substring(1);//NOI18N |
1265 |
return fileChooser.getHomePath() + text.substring(1);//NOI18N |
1263 |
} else { |
1266 |
} else { |
1264 |
int i = text.lastIndexOf("//");//NOI18N |
1267 |
int i = text.lastIndexOf("//");//NOI18N |
1265 |
if (i != -1) { |
1268 |
if (i != -1) { |
Lines 1267-1276
Link Here
|
1267 |
// (so that you can use "//" to start a new path, without selecting & deleting) |
1270 |
// (so that you can use "//" to start a new path, without selecting & deleting) |
1268 |
return text.substring(i + 1); |
1271 |
return text.substring(i + 1); |
1269 |
} |
1272 |
} |
1270 |
i = text.lastIndexOf(File.separatorChar + "~" + File.separatorChar);//NOI18N |
1273 |
i = text.lastIndexOf(fileSeparatorChar + "~" + fileSeparatorChar);//NOI18N |
1271 |
if (i != -1) { |
1274 |
if (i != -1) { |
1272 |
// Treat /usr/local/~/stuff as /home/me/stuff |
1275 |
// Treat /usr/local/~/stuff as /home/me/stuff |
1273 |
return System.getProperty("user.home") + text.substring(i + 2);//NOI18N |
1276 |
return fileChooser.getHomePath() + text.substring(i + 2);//NOI18N |
1274 |
} |
1277 |
} |
1275 |
return text; |
1278 |
return text; |
1276 |
} |
1279 |
} |
Lines 2521-2527
Link Here
|
2521 |
} |
2524 |
} |
2522 |
|
2525 |
|
2523 |
private void changeTreeDirectory(File dir) { |
2526 |
private void changeTreeDirectory(File dir) { |
2524 |
if (File.separatorChar == '\\' && dir.getPath().endsWith(".lnk")) {//NOI18N |
2527 |
if (fileSeparatorChar == '\\' && dir.getPath().endsWith(".lnk")) {//NOI18N |
2525 |
File linkLocation = getShellFolderForFileLinkLoc(dir); |
2528 |
File linkLocation = getShellFolderForFileLinkLoc(dir); |
2526 |
if (linkLocation != null && fileChooser.isTraversable(linkLocation)) { |
2529 |
if (linkLocation != null && fileChooser.isTraversable(linkLocation)) { |
2527 |
dir = linkLocation; |
2530 |
dir = linkLocation; |
Lines 3415-3424
Link Here
|
3415 |
} |
3418 |
} |
3416 |
} |
3419 |
} |
3417 |
|
3420 |
|
3418 |
private static boolean isGlobPattern(String filename) { |
3421 |
private boolean isGlobPattern(String filename) { |
3419 |
return ((File.separatorChar == '\\' && (filename.indexOf('*') >= 0 |
3422 |
return ((fileSeparatorChar == '\\' && (filename.indexOf('*') >= 0 |
3420 |
|| filename.indexOf('?') >= 0)) |
3423 |
|| filename.indexOf('?') >= 0)) |
3421 |
|| (File.separatorChar == '/' && (filename.indexOf('*') >= 0 |
3424 |
|| (fileSeparatorChar == '/' && (filename.indexOf('*') >= 0 |
3422 |
|| filename.indexOf('?') >= 0 |
3425 |
|| filename.indexOf('?') >= 0 |
3423 |
|| filename.indexOf('[') >= 0))); |
3426 |
|| filename.indexOf('[') >= 0))); |
3424 |
} |
3427 |
} |
Lines 3434-3440
Link Here
|
3434 |
public void setPattern(String globPattern) { |
3437 |
public void setPattern(String globPattern) { |
3435 |
char[] gPat = globPattern.toCharArray(); |
3438 |
char[] gPat = globPattern.toCharArray(); |
3436 |
char[] rPat = new char[gPat.length * 2]; |
3439 |
char[] rPat = new char[gPat.length * 2]; |
3437 |
boolean isWin32 = (File.separatorChar == '\\'); |
3440 |
boolean isWin32 = (fileSeparatorChar == '\\'); |
3438 |
boolean inBrackets = false; |
3441 |
boolean inBrackets = false; |
3439 |
int j = 0; |
3442 |
int j = 0; |
3440 |
|
3443 |
|