Skip to content

Commit 3bb3c37

Browse files
Luke BlevinsLuke Blevins
authored andcommitted
Revert "Ensure executable files are detected properly"
This reverts commit 5494482.
1 parent 5494482 commit 3bb3c37

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;
@@ -705,7 +704,6 @@ private async Task AddFile(StorageFile file)
705704
{
706705
var basicProperties = await file.GetBasicPropertiesAsync();
707706

708-
bool isExecutable = await IsFileExecutable(file);
709707
var itemName = file.DisplayName;
710708
var itemDate = basicProperties.DateModified;
711709
var itemPath = file.Path;
@@ -789,23 +787,12 @@ private async Task AddFile(StorageFile file)
789787
FileType = itemType,
790788
FilePath = itemPath,
791789
FileSize = itemSize,
792-
FileSizeBytes = itemSizeBytes,
793-
IsFileExecutable = isExecutable
790+
FileSizeBytes = itemSizeBytes
794791
});
795792

796793
EmptyTextState.isVisible = Visibility.Collapsed;
797794
}
798795

799-
public static async Task<bool> IsFileExecutable(StorageFile inputFile)
800-
{
801-
var firstTwoBytes = new byte[2];
802-
using(Stream stream = await inputFile.OpenStreamForReadAsync())
803-
{
804-
stream.Read(firstTwoBytes, 0, 2);
805-
}
806-
return Encoding.UTF8.GetString(firstTwoBytes) == "MZ";
807-
}
808-
809796
public async void FileContentsChanged(IStorageQueryResultBase sender, object args)
810797
{
811798
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 FolderRelativeId { get; }
1211
public Visibility FolderImg { get; set; }
1312
public Visibility FileIconVis { 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)