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

Fix for issue #1785 #1786

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions EditorExtensions/Misc/MenuItems/BundleFiles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ private void BeforeQueryStatus(object sender, params string[] extensions)

_files = ProjectHelpers.GetSelectedFilePaths();

menuCommand.Enabled = _files.All(file => extensions.Contains(Path.GetExtension(file))) &&
_files.Count() > 1;
menuCommand.Enabled = _files.Any(file => extensions.Contains(Path.GetExtension(file))) &&
_files.Count(file => extensions.Contains(Path.GetExtension(file))) > 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think all this can be replaced by one line:

menuCommand.Enabled = _files.Any(file => extensions.Contains(Path.GetExtension(file)));

Is it not what we are trying to say here?

Copy link
Author

Choose a reason for hiding this comment

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

I kept the original logic requiring that at least 2 files be required to create a bundle, but I have no problem with dropping this requirement so that single-file bundles can be created from the menu.

This might actually be useful in the case the you intend to start referencing the bundle immediately but add more files later.

Do I need to create a new pull request for this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I forgot about that! :)

So this will become:

menuCommand.Enabled = _files.Count(file => extensions.Contains(Path.GetExtension(file))) > 1;

Do I need to create a new pull request for this?

No. If you are using command line git, you can do the following:

# after making all the changes
cd into\WE2013\directory
git commit --amend
# close the notepad, or you can change the commit message there save and then close
git push -f
# to rewrite the commit history of your fork's branch
# this PR will automatically acquire your fork changes made in this particular branch

A pull request (PR) is always attached to your branch (in this case your master branch), as far as it is opened. So any changes you will make in that branch meanwhile, will be reflected in the PR.

}

private bool GetFileName(out string fileName, string extension)
Expand Down Expand Up @@ -185,7 +185,7 @@ private async Task MakeBundleAsync(string extension)

try
{
BundleDocument doc = new BundleDocument(bundleFile, _files.ToArray());
BundleDocument doc = new BundleDocument(bundleFile, _files.Where(file => Path.GetExtension(file) == extension).ToArray());

await doc.WriteBundleRecipe();
await GenerateAsync(doc, extension);
Expand Down