Skip to content

Commit 013b604

Browse files
committed
Revert "Ensure executable files are detected properly"
This reverts commit 52eeed3.
1 parent 52eeed3 commit 013b604

File tree

4 files changed

+4
-18
lines changed

4 files changed

+4
-18
lines changed

Files/Filesystem/ItemViewModel.cs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
using System.Linq;
1414
using System.Runtime.CompilerServices;
1515
using System.Runtime.InteropServices;
16-
using System.Text;
1716
using System.Threading;
1817
using System.Threading.Tasks;
1918
using Windows.ApplicationModel.Core;
@@ -723,7 +722,6 @@ private async Task AddFile(StorageFile file)
723722
{
724723
var basicProperties = await file.GetBasicPropertiesAsync();
725724

726-
bool isExecutable = await IsFileExecutable(file);
727725
var itemName = file.DisplayName;
728726
var itemDate = basicProperties.DateModified;
729727
var itemPath = file.Path;
@@ -807,23 +805,12 @@ private async Task AddFile(StorageFile file)
807805
FileType = itemType,
808806
FilePath = itemPath,
809807
FileSize = itemSize,
810-
FileSizeBytes = itemSizeBytes,
811-
IsFileExecutable = isExecutable
808+
FileSizeBytes = itemSizeBytes
812809
});
813810

814811
EmptyTextState.isVisible = Visibility.Collapsed;
815812
}
816813

817-
public static async Task<bool> IsFileExecutable(StorageFile inputFile)
818-
{
819-
var firstTwoBytes = new byte[2];
820-
using(Stream stream = await inputFile.OpenStreamForReadAsync())
821-
{
822-
stream.Read(firstTwoBytes, 0, 2);
823-
}
824-
return Encoding.UTF8.GetString(firstTwoBytes) == "MZ";
825-
}
826-
827814
public async void FileContentsChanged(IStorageQueryResultBase sender, object args)
828815
{
829816
if (_filesRefreshing)

Files/Filesystem/ListedItem.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ namespace Files.Filesystem
77
{
88
public class ListedItem
99
{
10-
public bool IsFileExecutable { get; set; }
1110
public string FolderTooltipText { get; set; }
1211
public string FolderRelativeId { get; }
1312
public Visibility FolderImg { get; set; }

Files/Interacts/Interaction.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ private async void OpenSelectedItems(bool displayApplicationPicker)
411411
currentInstance.ItemDisplayFrame.Navigate(sourcePageType, selectedItemPath, new SuppressNavigationTransitionInfo());
412412
}
413413
}
414-
else if (clickedOnItem.IsFileExecutable)
414+
else if (clickedOnItem.FileType == "Application")
415415
{
416416
// Add location to MRU List
417417
mostRecentlyUsed.Add(await StorageFile.GetFileFromPathAsync(clickedOnItem.FilePath));
@@ -438,7 +438,7 @@ private async void OpenSelectedItems(bool displayApplicationPicker)
438438
{
439439
instanceTabsView.AddNewTab(typeof(ProHome), clickedOnItem.FilePath);
440440
}
441-
else if (clickedOnItem.IsFileExecutable)
441+
else if (clickedOnItem.FileType == "Application")
442442
{
443443
// Add location to MRU List
444444
mostRecentlyUsed.Add(await StorageFile.GetFileFromPathAsync(clickedOnItem.FilePath));

Files/YourHome.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ private async void RecentsView_ItemClick(object sender, ItemClickEventArgs e)
330330
try
331331
{
332332
var file = (await StorageFile.GetFileFromPathAsync(path));
333-
if (await ItemViewModel.IsFileExecutable(file))
333+
if (file.DisplayType == "Application")
334334
{
335335
await Interaction.LaunchExe(path);
336336

0 commit comments

Comments
 (0)