diff options
| author | Sergey Prigogin | 2015-01-12 00:07:18 +0000 |
|---|---|---|
| committer | Dani Megert | 2015-01-15 19:24:21 +0000 |
| commit | f0785e1932f0d66008f6d54349f0bbdf341f9c0d (patch) | |
| tree | 6d6253f1eeb06b6b7c537ff092d0b55cac3025b5 /bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/unix/UnixFileNatives.java | |
| parent | 6596de6fd0e16907500ed1d85fb5e01be11bcf1c (diff) | |
| download | eclipse.platform.resources-f0785e1932f0d66008f6d54349f0bbdf341f9c0d.tar.gz eclipse.platform.resources-f0785e1932f0d66008f6d54349f0bbdf341f9c0d.tar.xz eclipse.platform.resources-f0785e1932f0d66008f6d54349f0bbdf341f9c0d.zip | |
Bug 338010. Fixed three tests failing on Mac.I20150203-1300I20150129-1830I20150128-2000I20150128-0900I20150127-2000I20150127-0900I20150126-2000I20150126-0930I20150126-0800I20150125-2000I20150120-0800I20150116-1000
Change-Id: I4c3641ec0e602c7f89edca62ae3b7f14dc23c49b
Signed-off-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
Diffstat (limited to 'bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/unix/UnixFileNatives.java')
| -rw-r--r-- | bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/unix/UnixFileNatives.java | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/unix/UnixFileNatives.java b/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/unix/UnixFileNatives.java index f3278629f..bdd1640dc 100644 --- a/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/unix/UnixFileNatives.java +++ b/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/unix/UnixFileNatives.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2012 IBM Corporation and others. + * Copyright (c) 2010, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,10 +7,11 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Sergey Prigogin (Google) - [338010] Resource.createLink() does not preserve symbolic links *******************************************************************************/ package org.eclipse.core.internal.filesystem.local.unix; -import java.io.UnsupportedEncodingException; +import java.io.*; import java.util.Enumeration; import org.eclipse.core.filesystem.EFS; import org.eclipse.core.filesystem.IFileInfo; @@ -92,6 +93,31 @@ public abstract class UnixFileNatives { if (getErrno() != ENOENT) info.setError(IFileInfo.IO_ERROR); } + + // Fill in the real name of the file. + File file = new File(fileName); + final String lastName = file.getName(); + // If the file does not exist, or the file system is not case sensitive, or the name + // of the file is not case sensitive, use the name we have. Otherwise obtain the real + // name of the file from a parent directory listing. + if (!info.exists() || EFS.getLocalFileSystem().isCaseSensitive() || + lastName.toLowerCase().equals(lastName.toUpperCase())) { + info.setName(lastName); + } else { + // Notice that file.getParentFile() is guaranteed to be not null since fileName == "/" + // case is handled by the other branch of the 'if' statement. + String[] names = file.getParentFile().list(new FilenameFilter() { + public boolean accept(File dir, String n) { + return n.equalsIgnoreCase(lastName); + } + }); + if (names.length == 1) { + info.setName(names[0]); + } else { + info.setName(lastName); + } + } + return info; } |
