Browse Source

Python-Run now sets the working directory to the directory of the file being run.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@6379 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Matt Ward 15 years ago
parent
commit
9dce6b380b
  1. 5
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/RunPythonCommand.cs
  2. 8
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/RunPythonCommandTestFixture.cs

5
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/RunPythonCommand.cs

@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
using System;
using System.Diagnostics;
using System.IO;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Debugging;
using ICSharpCode.SharpDevelop.Gui;
@ -55,7 +56,9 @@ namespace ICSharpCode.PythonBinding @@ -55,7 +56,9 @@ namespace ICSharpCode.PythonBinding
ProcessStartInfo GetProcessStartInfo()
{
ipy.PythonScriptFileName = workbench.ActiveWorkbenchWindow.ActiveViewContent.PrimaryFileName;
string scriptFileName = workbench.ActiveWorkbenchWindow.ActiveViewContent.PrimaryFileName;
ipy.PythonScriptFileName = scriptFileName;
ipy.WorkingDirectory = Path.GetDirectoryName(scriptFileName);
return ipy.GetProcessStartInfo();
}
}

8
src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/RunPythonCommandTestFixture.cs

@ -69,5 +69,13 @@ namespace PythonBinding.Tests.Gui @@ -69,5 +69,13 @@ namespace PythonBinding.Tests.Gui
{
Assert.AreEqual("\"C:\\Projects\\test.py\"", debugger.ProcessStartInfo.Arguments);
}
[Test]
public void WorkingDirectoryIsPathToPythonScriptFileBeingRun()
{
string workingDirectory = debugger.ProcessStartInfo.WorkingDirectory;
string expectedWorkingDirectory = @"C:\Projects";
Assert.AreEqual(expectedWorkingDirectory, workingDirectory);
}
}
}

Loading…
Cancel
Save