Browse Source

Fixed forum-7737: a solution could be opened with relative path from the command line.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@3048 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 18 years ago
parent
commit
01c819ff5c
  1. 13
      src/Main/Base/Project/Src/Commands/AutostartCommands.cs
  2. 4
      src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs

13
src/Main/Base/Project/Src/Commands/AutostartCommands.cs

@ -1,4 +1,5 @@ @@ -1,4 +1,5 @@
// <file>

// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
@ -7,6 +8,7 @@ @@ -7,6 +8,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
using ICSharpCode.Core;
@ -84,13 +86,16 @@ namespace ICSharpCode.SharpDevelop.Commands @@ -84,13 +86,16 @@ namespace ICSharpCode.SharpDevelop.Commands
NavigationService.SuspendLogging();
foreach (string file in fileList) {
LoggingService.Info("Open file " + file);
didLoadSolutionOrFile = true;
try {
IProjectLoader loader = ProjectService.GetProjectLoader(file);
string fullFileName = Path.GetFullPath(file);
IProjectLoader loader = ProjectService.GetProjectLoader(fullFileName);
if (loader != null) {
FileUtility.ObservedLoad(new NamedFileOperationDelegate(loader.Load), file);
loader.Load(fullFileName);
} else {
FileService.OpenFile(file);
FileService.OpenFile(fullFileName);
}
} catch (Exception e) {
MessageService.ShowError(e, "unable to open file " + file);

4
src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs

@ -243,6 +243,8 @@ namespace ICSharpCode.SharpDevelop.Project @@ -243,6 +243,8 @@ namespace ICSharpCode.SharpDevelop.Project
public static void LoadSolution(string fileName)
{
if (!Path.IsPathRooted(fileName))
throw new ArgumentException("Path must be rooted!");
BeforeLoadSolution();
OnSolutionLoading(fileName);
try {
@ -303,6 +305,8 @@ namespace ICSharpCode.SharpDevelop.Project @@ -303,6 +305,8 @@ namespace ICSharpCode.SharpDevelop.Project
/// </summary>
public static void LoadProject(string fileName)
{
if (!Path.IsPathRooted(fileName))
throw new ArgumentException("Path must be rooted!");
string solutionFile = Path.ChangeExtension(fileName, ".sln");
if (File.Exists(solutionFile)) {
LoadSolution(solutionFile);

Loading…
Cancel
Save