Repository: files-community/Files
File: src/Files.App/ViewModels/Dialogs/CreateShortcutDialogViewModel.cs (C#)

Code before:
					IsLocationValid = uri.IsWellFormedOriginalString();
					_isLocationInPath = false;
					_fullPath = DestinationItemPath;
				}
				catch (Exception)
				{
					DestinationPathExists = false;
					IsLocationValid = false;
					_isLocationInPath = false;
				}
			}
		}

		// Tells if the selected destination is valid (Path exists or URL is well-formed). Used to enable primary button
		private bool _isLocationValid;
		public bool IsLocationValid
		{
			get => _isLocationValid;
			set
			{
				if (SetProperty(ref _isLocationValid, value))
					OnPropertyChanged(nameof(ShowWarningTip));
			}
		}

		private bool _isLocationInPath;
		private string _fullPath;

		public bool ShowWarningTip => !string.IsNullOrEmpty(DestinationItemPath) && !_isLocationValid;

		// Command invoked when the user clicks the 'Browse' button
		public ICommand SelectDestinationCommand { get; private set; }

		// Command invoked when the user clicks primary button
		public ICommand PrimaryButtonCommand { get; private set; }

		public CreateShortcutDialogViewModel(string workingDirectory)
		{
			WorkingDirectory = workingDirectory;
			_destinationItemPath = string.Empty;

			SelectDestinationCommand = new AsyncRelayCommand(SelectDestination);
			PrimaryButtonCommand = new AsyncRelayCommand(CreateShortcutAsync);
		}

		private Task SelectDestination()
		{
			Win32PInvoke.BROWSEINFO bi = new Win32PInvoke.BROWSEINFO();
			bi.ulFlags = 0x00004000;
			bi.lpszTitle = "Select a folder";
			nint pidl = Win32PInvoke.SHBrowseForFolder(ref bi);

Review comment (suggestion):
Is the name of this field appropriate? I think a name like `_hasArguments` would be more appropriate.

Code after:
							return;
						}

						var quoted = trimmed[1..endQuoteIndex];

						if (quoted == _previousShortcutTargetPath)
						{
							Arguments = !Directory.Exists(FullPath) ? trimmed[(endQuoteIndex + 1)..] : string.Empty;
							return;
						}

						if (IsValidAbsolutePath(quoted))
						{
							DestinationPathExists = true;
							IsLocationValid = true;
							FullPath = Path.GetFullPath(quoted);
							Arguments = !Directory.Exists(FullPath) ? trimmed[(endQuoteIndex + 1)..] : string.Empty;
							_previousShortcutTargetPath = quoted;
							return;
						}

						// If the quoted part is a valid filename, try to find it in the PATH
						if (quoted == Path.GetFileName(quoted)
							&& quoted.IndexOfAny(Path.GetInvalidFileNameChars()) == -1
							&& PathHelpers.TryGetFullPath(quoted, out var fullPath))
						{
							DestinationPathExists = true;
							IsLocationValid = true;
							FullPath = fullPath;
							Arguments = trimmed[(endQuoteIndex + 1)..];
							_previousShortcutTargetPath = quoted;
							return;
						}

						var uri = new Uri(quoted);
						DestinationPathExists = false;
						IsLocationValid = uri.IsWellFormedOriginalString();
						FullPath = quoted;
						Arguments = string.Empty;
						_previousShortcutTargetPath = string.Empty;
					}
					else
					{
						var filePath = trimmed.Split(' ')[0];

						if (filePath == _previousShortcutTargetPath)
						{
							Arguments = !Directory.Exists(FullPath) ? trimmed.Split(' ')[1..].Aggregate(string.Empty, (current, arg) => current + arg + " ") : string.Empty;
							return;
						}