Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy UserForm resource file (.frx) along with UserForm source (.frm) on export #3129

Merged
merged 7 commits into from Jul 16, 2017
Merged

Conversation

ghost
Copy link

@ghost ghost commented Jul 14, 2017

Looking at a lot of the open issues with source control, it appeared that the underlying issue was that the UserForm resource file was simply not ending up in the same directory as the UserForm source file.

VBE does the work of the export, and we already read the contents of that source file... so, we just gotta get the resource file name and copy that file to the destination. This fix does just that.

With my testing, I believe that this closes: #2437, closes #2706, closes #2939, closes #2983, closes #2994, and closes #3019.

It might also be the solution to: #2315, #3126, but I don't know as other functionality is broken.

{
if (line.Contains("OleObjectBlob"))
{
var resourceFileName = line.Trim().Split(new Char[] { '"' }).ElementAt(1);
Copy link
Member

@Vogel612 Vogel612 Jul 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not line.Split("\"")[1].Trim()?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get an error when I try that: Cannot convert from 'string' to 'char'

@retailcoder
Copy link
Member

This is awesome, not losing the forms is a great first step in the right direction! ..and now I see what you were trying to do with that OleObjectBlob! 👍

@ghost
Copy link
Author

ghost commented Jul 14, 2017

After more testing, I don't think this closes all the issues I referenced. I'm looking into it now.

@retailcoder
Copy link
Member

@shadowofsilicon ok, I'll hold off on merging then.

var destPath = Directory.GetParent(path).FullName;
if (File.Exists(Path.Combine(tempFilePath, tempFile)) && !destPath.Equals(tempFilePath))
{
File.Copy(Path.Combine(tempFilePath, tempName), Path.Combine(destPath, resourceFileName), overwrite:true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the file be moved instead? It's a temp file anyway, we don't want to leave useless files around... why copy it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I noticed that too this morning.

@retailcoder
Copy link
Member

Still WIP or good to go?

@ghost
Copy link
Author

ghost commented Jul 16, 2017

Good to go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment