files-community / Files

A modern file manager that helps users organize their files and folders.
https://files.community
MIT License
34.76k stars 2.21k forks source link

Feature: Add app execution aliases and URL schemes for each build channel #13112

Open hishitetsu opened 1 year ago

hishitetsu commented 1 year ago

What feature or improvement do you think would benefit Files?

Currently all Files builds have the same app execution alias (Files.exe) and URL scheme (files-uwp:). But it is inconvenient when multiple Files builds are installed at the same time.

Requirements

Files Version

2.5.21.0

Windows Version

10.0.22621.1992

Comments

No response

yaira2 commented 1 year ago

We'll have to consider this and see if there are any downsides.

yaira2 commented 1 year ago

Do you have a list of places that will need updating?

hishitetsu commented 1 year ago

As far as I have been able to find out, here is.

Files.App (Package)\Package.appxmanifest(118):<uap:Protocol ReturnResults="none" Name="files-uwp" />
Files.App (Package)\Package.appxmanifest(123):<uap5:ExecutionAlias Alias="files.exe" />
Files.App.Launcher\FilesLauncher.cpp(175):std::wstring uriWithArgs = L"files-uwp:?cmd=" + str2wstr(wstring_to_utf8_hex(args));
Files.App.Launcher\FilesLauncher.cpp(190)://ShExecInfo.lpFile = L"files.exe";
Files.App.Launcher\FilesLauncher.cpp(205):ShExecInfo.lpFile = L"files-uwp:";
Files.App.Launcher\FilesLauncher.cpp(211)://ShExecInfo.lpFile = L"files.exe";
Files.App.OpenDialog\FilesOpenDialog.cpp(124):ShExecInfo.lpFile = L"files.exe";
Files.App\Actions\Navigation\OpenInNewWindowItemAction.cs(43):var folderUri = new Uri($"files-uwp:?folder={@selectedItemPath}");
Files.App\App.xaml.cs(312):!Process.GetProcessesByName("Files").Any(x => x.Id != Process.GetCurrentProcess().Id))
Files.App\App.xaml.cs(538):await Launcher.LaunchUriAsync(new Uri("files-uwp:"));
Files.App\Helpers\Navigation\NavigationHelpers.cs(23):var folderUri = new Uri($"files-uwp:?folder={Uri.EscapeDataString(path)}");
Files.App\Helpers\Navigation\NavigationHelpers.cs(29):var folderUri = new Uri($"files-uwp:?tab={Uri.EscapeDataString(tabArgs)}");
Files.App\Helpers\Navigation\NavigationHelpers.cs(43):var filesUWPUri = new Uri("files-uwp:");
Files.App\MainWindow.xaml.cs(82):(CommandLineParser.SplitArguments(launchArgs.Arguments, true)[0].EndsWith($"files.exe", StringComparison.OrdinalIgnoreCase)
Files.App\MainWindow.xaml.cs(83):|| CommandLineParser.SplitArguments(launchArgs.Arguments, true)[0].EndsWith($"files", StringComparison.OrdinalIgnoreCase)))
Files.App\MainWindow.xaml.cs(109):if (eventArgs.Uri.AbsoluteUri == "files-uwp:")
Files.App\Program.cs(94):!tileArgs.Arguments.Contains($"files.exe", StringComparison.OrdinalIgnoreCase) &&
Files.App\Utils\Storage\StorageItems\ZipStorageFolder.cs(107):|| assoc.EndsWith("Files.App\\Files.exe", StringComparison.OrdinalIgnoreCase)
Files.App\ViewModels\MainPageViewModel.cs(105):var filesUWPUri = new Uri("files-uwp:");
Files.App\ViewModels\Settings\GeneralViewModel.cs(120):await Launcher.LaunchUriAsync(new Uri("files-uwp:")); // Launches a new instance of Files

Note that FilesLauncher will not be able to select an item at startup unless the GPL code deletion is reverted.

yaira2 commented 1 year ago

Files.App (Package)\Package.appxmanifest(118): Files.App (Package)\Package.appxmanifest(123):

These will need to be updated from the pipeline, but I think everything else can be done with variables that are set based on the environment.

0x5bfa commented 1 year ago

I'm going to add app.manifest for each configurations, DEBUG, STABLE, STORE to fix issues like this and it will allow us to remove updating manifest xml components in the pipeline.

The packaging project file will determine what manifest should be used:

Files.Package.wapproj
  <ItemGroup>
    <AppxManifest Include="Package.Dev.appxmanifest" Condition="'$(Configuration)' == 'Dev'">
      <SubType>Designer</SubType>
    </AppxManifest>
    <AppxManifest Include="Package.Store.appxmanifest" Condition="'$(Configuration)' == 'Store'">
      <SubType>Designer</SubType>
    </AppxManifest>
  </ItemGroup>
0x5bfa commented 1 year ago

And the ApplicationService or #if #endif directives can determine what alias should be used in the platform projects.

@yaira2 what do you think?

heftymouse commented 1 year ago

ApplicationService sounds good 👍

yaira2 commented 1 year ago

STABLE

This approach would work, but it means duplicating every change to those files. Alternatively, we could have a build script that automates copying the changes but at that point it's not much better than doing it from the pipeline.

Josh65-2201 commented 11 months ago

The set as default option would also have to be updated to use the new names as the reg file just assumes files.exe right now

0x5bfa commented 11 months ago

@yaira2 Do you think app URI scheme can be just files.exe instead of files-app.exe?

yaira2 commented 11 months ago

The app reduces the chance that another app will have the same scheme but we can try without.

0x5bfa commented 2 months ago

Does this look ok https://github.com/files-community/Files/compare/main...0x5bfa:5bfa/CQ-SeparatedAppAlias

I think we should also update system tray icon guid to be unique per.

yaira2 commented 2 months ago

@0x5bfa we need to make some adjustments as well as update the Azure Pipeline, but your branch looks good 👍