/** @deprecated since 0.7.0, use {@link #isAbsolutish(String)} */ @Deprecated public static boolean isAbsolute(String path) { return isAbsolutish(path); }
public void testIsAbsolutish() { assertFalse(Os.isAbsolutish("")); assertFalse(Os.isAbsolutish("foo/bar")); assertTrue(Os.isAbsolutish("/")); assertTrue(Os.isAbsolutish("~/")); assertTrue(Os.isAbsolutish("~")); assertTrue(Os.isAbsolutish("/foo/bar")); }
final String source = checkNotNull(entry.getKey(), "Missing source for resource"); String target = checkNotNull(entry.getValue(), "Missing destination for resource"); final String destination = Os.isAbsolutish(target) ? target : Os.mergePathsUnix(destinationParentDir, target);
protected static String resolveAgainstBaseDir(StringConfigMap brooklynProperties, String path) { if (!Os.isAbsolutish(path)) path = Os.mergePaths(getMgmtBaseDir(brooklynProperties), path); return Os.tidyPath(path); }
String destination = Os.isAbsolutish(target) ? target : Os.mergePathsUnix(getRunDir(), target);
@Beta public static String makeCommandExecutingInDirectory(String command, String executionDir, Entity entity) { String finalCommand = command; String execDir = executionDir; if (Strings.isBlank(execDir)) { // default to run dir execDir = entity.getAttribute(BrooklynConfigKeys.RUN_DIR); // if no run dir, default to home if (Strings.isBlank(execDir)) { execDir = "~"; } } else if (!Os.isAbsolutish(execDir)) { // relative paths taken wrt run dir String runDir = entity.getAttribute(BrooklynConfigKeys.RUN_DIR); if (!Strings.isBlank(runDir)) { execDir = Os.mergePaths(runDir, execDir); } } if (!"~".equals(execDir)) { finalCommand = "mkdir -p '"+execDir+"' && cd '"+execDir+"' && "+finalCommand; } return finalCommand; }
String destination = Os.isAbsolutish(target) ? target : Os.mergePathsUnix(getRunDir(), target);
if (entity.getConfig(BrooklynConfigKeys.SKIP_ON_BOX_BASE_DIR_RESOLUTION) || machine.getConfig(BrooklynConfigKeys.SKIP_ON_BOX_BASE_DIR_RESOLUTION)) { if (log.isDebugEnabled()) log.debug("Skipping on-box base dir resolution for "+entity+" at "+machine); if (!Os.isAbsolutish(base)) base = "~/"+base; resolvedBase = Os.tidyPath(base); } else if (machine instanceof SshMachineLocation) { if (!Os.isAbsolutish(base)) base = "~/"+base; resolvedBase = Os.tidyPath(base); log.warn("Could not resolve on-box directory for "+entity+" at "+machine+"; using "+resolvedBase+", though this may not be accurate at the target (and may fail shortly)");