/** {@inheritDoc} */ @Override public boolean isCaseSensitive() { return !SystemReader.getInstance().isMacOS(); }
/** * On Mac: get NFC normalized form of given name, otherwise the given name. * * @param name * a {@link java.lang.String} object. * @return on Mac: NFC normalized form of given name * @since 4.1 */ public static String normalize(String name) { if (SystemReader.getInstance().isMacOS()) { if (name == null) return null; return Normalizer.normalize(name, Normalizer.Form.NFC); } return name; }
/** * NFC normalize a file (on Mac), otherwise do nothing * * @param file * a {@link java.io.File}. * @return on Mac: NFC normalized {@link java.io.File}, otherwise the passed * file * @since 4.1 */ public static File normalize(File file) { if (SystemReader.getInstance().isMacOS()) { // TODO: Would it be faster to check with isNormalized first // assuming normalized paths are much more common String normalized = Normalizer.normalize(file.getPath(), Normalizer.Form.NFC); return new File(normalized); } return file; }
/** * Read target path of the symlink. * * @param path * a {@link java.io.File} object. * @return target path of the symlink, or null if it is not a symbolic link * @throws java.io.IOException * @since 3.0 */ public static String readSymLink(File path) throws IOException { Path nioPath = toPath(path); Path target = Files.readSymbolicLink(nioPath); String targetString = target.toString(); if (SystemReader.getInstance().isWindows()) { targetString = targetString.replace('\\', '/'); } else if (SystemReader.getInstance().isMacOS()) { targetString = Normalizer.normalize(targetString, Form.NFC); } return targetString; }
/** * Should be used in tests when the platform is explicitly changed. * * @since 3.6 */ protected final void setPlatformChecker() { platformChecker = new ObjectChecker() .setSafeForWindows(isWindows()) .setSafeForMacOS(isMacOS()); }
/** {@inheritDoc} */ @Override protected File discoverGitExe() { String path = SystemReader.getInstance().getenv("PATH"); //$NON-NLS-1$ File gitExe = searchPath(path, "git"); //$NON-NLS-1$ if (gitExe == null) { if (SystemReader.getInstance().isMacOS()) { if (searchPath(path, "bash") != null) { //$NON-NLS-1$ // On MacOSX, PATH is shorter when Eclipse is launched from the // Finder than from a terminal. Therefore try to launch bash as a // login shell and search using that. String w; try { w = readPipe(userHome(), new String[]{"bash", "--login", "-c", "which git"}, // //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ Charset.defaultCharset().name()); } catch (CommandFailedException e) { LOG.warn(e.getMessage()); return null; } if (!StringUtils.isEmptyOrNull(w)) { gitExe = new File(w); } } } } return gitExe; }
@SuppressWarnings("deprecation") private static void checkValidPath(CanonicalTreeParser t) throws InvalidPathException { ObjectChecker chk = new ObjectChecker() .setSafeForWindows(SystemReader.getInstance().isWindows()) .setSafeForMacOS(SystemReader.getInstance().isMacOS()); for (CanonicalTreeParser i = t; i != null; i = i.getParent()) checkValidPathSegment(chk, i); }
SystemReader.getInstance().isWindows()); safeForMacOS = rc.getBoolean(FSCK, "safeForMacOS", SystemReader.getInstance().isMacOS());
cfg.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_LOGALLREFUPDATES, !bare); if (SystemReader.getInstance().isMacOS())
public static File normalize(File file) { if (SystemReader.getInstance().isMacOS()) { // TODO: Would it be faster to check with isNormalized first // assuming normalized paths are much more common String normalized = Normalizer.normalize(file.getPath(), Normalizer.Form.NFC); return new File(normalized); } return file; }
public static String normalize(String name) { if (SystemReader.getInstance().isMacOS()) { if (name == null) return null; return Normalizer.normalize(name, Normalizer.Form.NFC); } return name; }
public static String normalize(String name) { if (SystemReader.getInstance().isMacOS()) { if (name == null) return null; return Normalizer.normalize(name, Normalizer.Form.NFC); } return name; }
public static File normalize(File file) { if (SystemReader.getInstance().isMacOS()) { // TODO: Would it be faster to check with isNormalized first // assuming normalized paths are much more common String normalized = Normalizer.normalize(file.getPath(), Normalizer.Form.NFC); return new File(normalized); } return file; }
/** {@inheritDoc} */ @Override public boolean isCaseSensitive() { return !SystemReader.getInstance().isMacOS(); }
static String readSymlink(File path) throws IOException { Path nioPath = path.toPath(); Path target = Files.readSymbolicLink(nioPath); String targetString = target.toString(); if (SystemReader.getInstance().isWindows()) targetString = targetString.replace('\\', '/'); else if (SystemReader.getInstance().isMacOS()) targetString = Normalizer.normalize(targetString, Form.NFC); return targetString; }
static String readSymlink(File path) throws IOException { Path nioPath = path.toPath(); Path target = Files.readSymbolicLink(nioPath); String targetString = target.toString(); if (SystemReader.getInstance().isWindows()) targetString = targetString.replace('\\', '/'); else if (SystemReader.getInstance().isMacOS()) targetString = Normalizer.normalize(targetString, Form.NFC); return targetString; }
/** * Should be used in tests when the platform is explicitly changed. * * @since 3.6 */ protected final void setPlatformChecker() { platformChecker = new ObjectChecker() .setSafeForWindows(isWindows()) .setSafeForMacOS(isMacOS()); }
/** * Should be used in tests when the platform is explicitly changed. * * @since 3.6 */ protected final void setPlatformChecker() { platformChecker = new ObjectChecker() .setSafeForWindows(isWindows()) .setSafeForMacOS(isMacOS()); }
@SuppressWarnings("deprecation") private static void checkValidPath(CanonicalTreeParser t) throws InvalidPathException { ObjectChecker chk = new ObjectChecker() .setSafeForWindows(SystemReader.getInstance().isWindows()) .setSafeForMacOS(SystemReader.getInstance().isMacOS()); for (CanonicalTreeParser i = t; i != null; i = i.getParent()) checkValidPathSegment(chk, i); }
@SuppressWarnings("deprecation") private static void checkValidPath(CanonicalTreeParser t) throws InvalidPathException { ObjectChecker chk = new ObjectChecker() .setSafeForWindows(SystemReader.getInstance().isWindows()) .setSafeForMacOS(SystemReader.getInstance().isMacOS()); for (CanonicalTreeParser i = t; i != null; i = i.getParent()) checkValidPathSegment(chk, i); }