comparison src/org/tmatesoft/hg/internal/Internals.java @ 413:7f27122011c3

Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 21 Mar 2012 20:40:28 +0100
parents b015f3918120
children bb278ccf9866
comparison
equal deleted inserted replaced
406:d56ea1a2537a 413:7f27122011c3
160 public static boolean runningOnWindows() { 160 public static boolean runningOnWindows() {
161 return System.getProperty("os.name").indexOf("Windows") != -1; 161 return System.getProperty("os.name").indexOf("Windows") != -1;
162 } 162 }
163 163
164 /** 164 /**
165 * @param hint optional hint pointing to filesystem of interest (generally, it's possible to mount
166 * filesystems with different capabilities and repository's capabilities would depend on which fs it resides)
167 * @return <code>true</code> if executable files deserve tailored handling
168 */
169 public static boolean checkSupportsExecutables(File fsHint) {
170 // *.exe are not executables for Mercurial
171 return !runningOnWindows();
172 }
173
174 /**
175 * @param hint optional hint pointing to filesystem of interest (generally, it's possible to mount
176 * filesystems with different capabilities and repository's capabilities would depend on which fs it resides)
177 * @return <code>true</code> if filesystem knows what symbolic links are
178 */
179 public static boolean checkSupportsSymlinks(File fsHint) {
180 // Windows supports soft symbolic links starting from Vista
181 // However, as of Mercurial 2.1.1, no support for this functionality
182 // XXX perhaps, makes sense to override with a property a) to speed up when no links are in use b) investigate how this runs windows
183 return !runningOnWindows();
184 }
185
186
187 /**
165 * For Unix, returns installation root, which is the parent directory of the hg executable (or symlink) being run. 188 * For Unix, returns installation root, which is the parent directory of the hg executable (or symlink) being run.
166 * For Windows, it's Mercurial installation directory itself 189 * For Windows, it's Mercurial installation directory itself
167 * @param ctx 190 * @param ctx
168 */ 191 */
169 private static File findHgInstallRoot(SessionContext ctx) { 192 private static File findHgInstallRoot(SessionContext ctx) {