Skip to content

Commit 5f0fad9

Browse files
committed
Undo works.
1 parent fce5d8d commit 5f0fad9

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Rubberduck.SourceControl/SourceControlProviderBase.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,7 @@ public virtual void Undo(string filePath)
103103
{
104104
var componentName = Path.GetFileNameWithoutExtension(filePath);
105105

106-
//GetFileNameWithoutExtension returns empty string if it's not a file
107-
//https://msdn.microsoft.com/en-us/library/system.io.path.getfilenamewithoutextension%28v=vs.110%29.aspx
108-
if (componentName != string.Empty)
106+
if (!File.Exists(filePath))
109107
{
110108
var component = Project.VBComponents.Item(componentName);
111109
Project.VBComponents.RemoveSafely(component);

Rubberduck.VBEEditor/Extensions/VBComponentsExtensions.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.IO;
1+
using System;
2+
using System.IO;
23
using Microsoft.Vbe.Interop;
34

45
// todo: untangle this mess
@@ -37,6 +38,8 @@ public static void ImportSourceFile(this VBComponents components, string filePat
3738
var ext = Path.GetExtension(filePath);
3839
var fileName = Path.GetFileNameWithoutExtension(filePath);
3940

41+
if (!File.Exists(filePath)) { return; }
42+
4043
if (ext == VBComponentExtensions.DocClassExtension)
4144
{
4245
var component = components.Item(fileName);

0 commit comments

Comments
 (0)