public String getRemotePath(String localPath) { return pathMap.getRemotePath(localPath,true); }
public abstract String getRemotePath(String lpath, boolean useDefault); }
@Override public void process(File file, Writer err) throws PathMapperException, InterruptedException, ExecutionException, IOException { String remotePath = pathMap.getRemotePath(file.getAbsolutePath(), false); if (remotePath == null) { throw new RemoteSyncSupport.PathMapperException(file); } Future<Integer> task = CommonTasksSupport.downloadFile(remotePath, execEnv, file.getAbsolutePath(), err); int rc = task.get(); if (rc != 0) { throw new IOException(NbBundle.getMessage(RemoteSyncActions.class, "ERR_RC", rc)); } } @Override
protected static String convertToRemoteIfNeeded(ExecutionEnvironment execEnv, String localDir, Project project) { if (!checkConnection(execEnv)) { return null; } if (execEnv.isRemote()) { final PathMap pathMap = RemoteSyncSupport.getPathMap(execEnv, project); String remotePath = pathMap.getRemotePath(localDir, false); if (remotePath == null) { if (!pathMap.checkRemotePaths(new File[]{new File(localDir)}, true)) { return null; } remotePath = pathMap.getRemotePath(localDir, false); } return remotePath; } return localDir; }
public final String localToRemote(String who, String path) { String mapped; if (path == null) { mapped = path; } else if (NativeDebuggerManager.isStandalone()) { mapped = path; } else { PathMap pm = getPathMap(); if (pm == null) { mapped = path; } else { mapped = pm.getRemotePath(path); if (mapped == null) { // no mapping was found mapped = path; } } } if (Log.PathMap.debug) { System.out.printf("localToRemote - %s\n", who); // NOI18N System.out.printf(" from: %s\n", path); // NOI18N System.out.printf(" to: %s\n", mapped); // NOI18N } return mapped; }
public static String getRunCommandAsString(String command, MakeConfiguration configuration, PathMap mapper) { String outputValue = ""; // NOI18N if (!configuration.isLibraryConfiguration()) { if (configuration.getOutputValue().length() > 0) { outputValue = configuration.getAbsoluteOutputValue(); } } if (configuration.getPlatformInfo().isLocalhost()) { command = CndPathUtilities.expandAllMacroses(command, MakeConfiguration.CND_OUTPUT_PATH_MACRO, outputValue); // NOI18N } else { // if (!configuration.getDevelopmentHost().isLocalhost()) { if (!outputValue.isEmpty()) { if (mapper != null) { String aValue = mapper.getRemotePath(outputValue, true); if (aValue != null) { outputValue = aValue; } } else { LOGGER.log(Level.SEVERE, "Path Mapper not found for the project - using local path {0}", new Object[]{outputValue}); //NOI18N } } command = CndPathUtilities.expandAllMacroses(command, "${OUTPUT_PATH}", outputValue); // NOI18N } return configuration.expandMacros(command); }
String wd = conf.getMakefileConfiguration().getAbsBuildCommandWorkingDir(); if (mapper != null) { String aWd = mapper.getRemotePath(conf.getMakefileConfiguration().getAbsBuildCommandWorkingDir(), true); if (aWd != null) { wd = aWd;
realSeed = pathMap.getRemotePath(seed, true);
public static String convertWorkingDirToRemoteIfNeeded(ProjectActionEvent pae, String localDir) { ExecutionEnvironment execEnv = pae.getConfiguration().getDevelopmentHost().getExecutionEnvironment(); if (!checkConnection(execEnv)) { return null; } if (execEnv.isRemote()) { PathMap mapper = RemoteSyncSupport.getPathMap(pae.getProject()); if (mapper != null) { String aLocalDir = mapper.getRemotePath(localDir, false); if (aLocalDir != null) { localDir = aLocalDir; } } else { LOGGER.log(Level.SEVERE, "Path Mapper not found for project {0} - using local path {1}", new Object[]{pae.getProject(), localDir}); //NOI18N } return localDir; } return localDir; }
private static String getOutput(MakeConfigurationDescriptor projectDescriptor, MakeConfiguration conf, CompilerSet compilerSet) { String output = conf.getOutputValue(); if (!conf.getDevelopmentHost().isLocalhost() && ! output.startsWith("$") && ! CndPathUtilities.isPathAbsolute(output)) { //NOI18N PathMap mapper = RemoteSyncSupport.getPathMap(projectDescriptor.getProject()); if (mapper != null) { output = mapper.getRemotePath(output, true); if (output == null) { output = conf.getOutputValue(); } } else { LOGGER.log(Level.SEVERE, "Path Mapper not found for project {0} - using local path {1}", new Object[]{projectDescriptor.getProject(), output}); // NOI18N } } switch (conf.getDevelopmentHost().getBuildPlatform()) { case PlatformTypes.PLATFORM_WINDOWS: switch (conf.getConfigurationType().getValue()) { case MakeConfiguration.TYPE_APPLICATION: case MakeConfiguration.TYPE_DB_APPLICATION: case MakeConfiguration.TYPE_QT_APPLICATION: output = mangleAppnameWin(output); break; } break; } if (compilerSet != null) { output = CppUtils.normalizeDriveLetter(compilerSet, output); } return output; }
public String getExecutable() { String result; if (type == PredefinedType.RUN || type == PredefinedType.DEBUG || type == PredefinedType.DEBUG_STEPINTO) { result = getExecutableFromRunCommand(); if (result != null && result.length() > 0) { ExecutionEnvironment execEnv = configuration.getDevelopmentHost().getExecutionEnvironment(); if (!CndPathUtilities.isPathAbsolute(result)) { CndUtils.assertTrueInConsole(false, "getExecutableFromRunCommand() returned non-absolute path", result); //NOI18N String baseDir = configuration.getProfile().getRunDirectory(); if (execEnv.isRemote()) { PathMap mapper = RemoteSyncSupport.getPathMap(getProject()); if (mapper != null) { baseDir = mapper.getRemotePath(baseDir, true); if (baseDir == null) { baseDir = configuration.getProfile().getRunDirectory(); } } else { LOGGER.log(Level.SEVERE, "Path Mapper not found for project {0} - using local path {1}", new Object[]{getProject(), baseDir}); //NOI18N } } result = baseDir + FileSystemProvider.getFileSeparatorChar(execEnv) + result; } result = FileSystemProvider.normalizeAbsolutePath(result, execEnv); } } else { result = executable; } return result; }
PathMap mapper = RemoteSyncSupport.getPathMap(pae.getProject()); if (mapper != null) { String anExecutable = mapper.getRemotePath(executable, true); if (anExecutable != null) { executable = anExecutable;
@Override public void actionPerformed(ActionEvent e) { for (int i = handleEvents.paes.length - 1; i >= 0; i--) { ProjectActionEvent pae = handleEvents.paes[i]; if (ProjectActionSupport.checkProject(pae)) { String projectName = ProjectUtils.getInformation(pae.getProject()).getDisplayName(); String dir = pae.getProfile().getRunDirectory(); ExecutionEnvironment env = pae.getConfiguration().getDevelopmentHost().getExecutionEnvironment(); if (env.isRemote()) { if (RemoteFileUtil.getProjectSourceExecutionEnvironment(pae.getProject()).isLocal()) { PathMap pathMap = RemoteSyncSupport.getPathMap(pae.getProject()); if (pathMap != null) { String aDir = pathMap.getRemotePath(dir); if (aDir != null) { dir = aDir; } } else { LOGGER.log(Level.SEVERE, "Path Mapper not found for project {0} - using local path {1}", new Object[]{pae.getProject(), dir}); //NOI18N } } } TerminalSupport.openTerminal(getString("TargetExecutor.TermAction.tabTitle", projectName, env.getDisplayName()), env, dir); // NOI18N } break; } } }
path = RemoteSyncSupport.getPathMap(exEnv, project).getRemotePath(path, true);