Merge branch 'master' into traff/zip_helpers
[idea/community.git] / python / src / com / jetbrains / python / run / PythonCommandLineState.java
index 14f6b73cf3086ba75a400d78bc27ac3e608e15e9..79c51cb584f275dc489dc4fed75b9ff7f394043d 100644 (file)
@@ -57,6 +57,7 @@ import com.jetbrains.python.debugger.PyDebuggerOptionsProvider;
 import com.jetbrains.python.facet.LibraryContributingFacet;
 import com.jetbrains.python.facet.PythonPathContributingFacet;
 import com.jetbrains.python.library.PythonLibraryType;
+import com.jetbrains.python.remote.PyRemotePathMapper;
 import com.jetbrains.python.sdk.PySdkUtil;
 import com.jetbrains.python.sdk.PythonEnvUtil;
 import com.jetbrains.python.sdk.PythonSdkAdditionalData;
@@ -186,11 +187,11 @@ public abstract class PythonCommandLineState extends CommandLineState {
     Sdk sdk = PythonSdkType.findSdkByPath(myConfig.getInterpreterPath());
     final ProcessHandler processHandler;
     if (PySdkUtil.isRemote(sdk)) {
-      processHandler =
-        createRemoteProcessStarter().startRemoteProcess(sdk, commandLine, myConfig.getProject(), myConfig.getMappingSettings());
+      PyRemotePathMapper pathMapper = createRemotePathMapper();
+      processHandler = createRemoteProcessStarter().startRemoteProcess(sdk, commandLine, myConfig.getProject(), pathMapper);
     }
     else {
-      EncodingEnvironmentUtil.fixDefaultEncodingIfMac(commandLine, myConfig.getProject());
+      EncodingEnvironmentUtil.setLocaleEnvironmentIfMac(commandLine);
       processHandler = doCreateProcess(commandLine);
       ProcessTerminatedListener.attach(processHandler);
     }
@@ -201,6 +202,15 @@ public abstract class PythonCommandLineState extends CommandLineState {
     return processHandler;
   }
 
+  @Nullable
+  private PyRemotePathMapper createRemotePathMapper() {
+    if (myConfig.getMappingSettings() == null) {
+      return null;
+    } else {
+      return PyRemotePathMapper.fromSettings(myConfig.getMappingSettings(), PyRemotePathMapper.PyPathMappingType.USER_DEFINED);
+    }
+  }
+
   protected PyRemoteProcessStarter createRemoteProcessStarter() {
     return new PyRemoteProcessStarter();
   }