Skip to content

Commit 194dc48

Browse files
committed
Closes #4454 -- We now check that folder exists and if not, create it. This might still blow up but hopefully it should be more explicit?
1 parent 488ed2e commit 194dc48

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Rubberduck.VBEditor.VBA/SafeComWrappers/VB/VBComponent.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,18 @@ public bool HasDesigner
9696
/// </summary>
9797
/// <param name="folder">Destination folder for the resulting source file.</param>
9898
/// <param name="tempFile">True if a unique temp file name should be generated. WARNING: filenames generated with this flag are not persisted.</param>
99-
/// <param name="specialCaseDocumentModules">If reimpot of a document file is required later, it has to receive special treatment.</param>
99+
/// <param name="specialCaseDocumentModules">If reimport of a document file is required later, it has to receive special treatment.</param>
100100
public string ExportAsSourceFile(string folder, bool tempFile = false, bool specialCaseDocumentModules = true)
101101
{
102102
var fullPath = tempFile
103103
? Path.Combine(folder, Path.GetRandomFileName())
104104
: Path.Combine(folder, SafeName + Type.FileExtension());
105+
106+
if (!Directory.Exists(folder))
107+
{
108+
Directory.CreateDirectory(folder);
109+
}
110+
105111
switch (Type)
106112
{
107113
case ComponentType.UserForm:

0 commit comments

Comments
 (0)