Browse Source

Fixed forum-13637: adding new file to project stored on network drive creates file in wrong path

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2144 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 19 years ago
parent
commit
845e2c2f3e
  1. 10
      src/Main/Base/Project/Src/Gui/Dialogs/NewFileDialog.cs

10
src/Main/Base/Project/Src/Gui/Dialogs/NewFileDialog.cs

@ -371,8 +371,16 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -371,8 +371,16 @@ namespace ICSharpCode.SharpDevelop.Gui
string parsedFileName = StringParser.Parse(newfile.Name);
// Parse twice so that tags used in included standard header are parsed
string parsedContent = StringParser.Parse(StringParser.Parse(content));
if (parsedFileName.StartsWith("/") || parsedFileName.StartsWith("\\"))
// when newFile.Name is "${Path}/${FileName}", there might be a useless '/' in front of the file name
// if the file is created when no project is opened. So we remove single '/' or '\', but not double
// '\\' (project is saved on network share).
if (parsedFileName.StartsWith("/") && !parsedFileName.StartsWith("//")
|| parsedFileName.StartsWith("\\") && !parsedFileName.StartsWith("\\\\"))
{
parsedFileName = parsedFileName.Substring(1);
}
if (newfile.IsDependentFile && Path.IsPathRooted(parsedFileName)) {
Directory.CreateDirectory(Path.GetDirectoryName(parsedFileName));
if (binaryContent != null)

Loading…
Cancel
Save