Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
22 changes: 16 additions & 6 deletions API-Reference/Flow.Launcher.Plugin.SharedCommands/FilesFolders.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# FilesFolders class

Commands that are useful to run on files... and folders!

```csharp
public static class FilesFolders
```
Expand All @@ -9,15 +11,23 @@ public static class FilesFolders
| name | description |
| --- | --- |
| static [CopyAll](FilesFolders/CopyAll.md)(…) | Copies the folder and all of its files and folders including subfolders to the target location |
| static [FileExists](FilesFolders/FileExists.md)(…) | |
| static [EnsureTrailingSlash](FilesFolders/EnsureTrailingSlash.md)(…) | Returns path ended with "\" |
| static [FileExists](FilesFolders/FileExists.md)(…) | Checks if a file exists |
| static [FileOrLocationExists](FilesFolders/FileOrLocationExists.md)(…) | Checks if a file or directory exists |
| static [GetPreviousExistingDirectory](FilesFolders/GetPreviousExistingDirectory.md)(…) | Gets the previous level directory from a path string. Checks that previous level directory exists and returns it as a path string, or empty string if doesn't exist |
| static [IsLocationPathString](FilesFolders/IsLocationPathString.md)(…) | This checks whether a given string is a directory path or network location string. It does not check if location actually exists. |
| static [LocationExists](FilesFolders/LocationExists.md)(…) | |
| static [OpenContainingFolder](FilesFolders/OpenContainingFolder.md)(…) | |
| static [OpenPath](FilesFolders/OpenPath.md)(…) | |
| static [RemoveFolderIfExists](FilesFolders/RemoveFolderIfExists.md)(…) | |
| static [IsZipFilePath](FilesFolders/IsZipFilePath.md)(…) | This checks whether a given string is a zip file path. By default does not check if the zip file actually exist on disk, can do so by setting checkFileExists = true. |
| static [LocationExists](FilesFolders/LocationExists.md)(…) | Checks if a directory exists |
| static [OpenFile](FilesFolders/OpenFile.md)(…) | Open a file with associated application |
| static [OpenPath](FilesFolders/OpenPath.md)(…) | Open a directory window (using the OS's default handler, usually explorer) |
| static [PathContains](FilesFolders/PathContains.md)(…) | Returns if *parentPath* contains *subPath*. Equal paths are not considered to be contained by default. From https://stackoverflow.com/a/66877016 |
| static [RemoveFolderIfExists](FilesFolders/RemoveFolderIfExists.md)(…) | Deletes a folder if it exists |
| static [ResolveAbsolutePath](FilesFolders/ResolveAbsolutePath.md)(…) | Resolves a path that may be relative to an absolute path. If the path is already absolute, returns it as-is. If the path is not rooted (as determined by String)), resolves it relative to ProgramDirectory. |
| static [ReturnPreviousDirectoryIfIncompleteString](FilesFolders/ReturnPreviousDirectoryIfIncompleteString.md)(…) | Returns the previous level directory if path incomplete (does not end with '\'). Does not check if previous level directory exists. Returns passed in string if is complete path |
| static [VerifyBothFolderFilesEqual](FilesFolders/VerifyBothFolderFilesEqual.md)(…) | |
| static [TryDeleteDirectoryRobust](FilesFolders/TryDeleteDirectoryRobust.md)(…) | Attempts to delete a directory robustly with retry logic for locked files. This method tries to delete files individually with retries, then removes empty directories. Returns true if the directory was completely deleted, false if some files/folders remain. |
| static [ValidateDataDirectory](FilesFolders/ValidateDataDirectory.md)(…) | Validates a data directory, synchronizing it by ensuring all files from a bundled source directory exist in it. If files are missing or outdated, they are copied from the bundled directory to the data directory. |
| static [ValidateDirectory](FilesFolders/ValidateDirectory.md)(…) | Validates a directory, creating it if it doesn't exist |
| static [VerifyBothFolderFilesEqual](FilesFolders/VerifyBothFolderFilesEqual.md)(…) | Check if the files and directories are identical between *fromPath* and *toPath* |

## See Also

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
Copies the folder and all of its files and folders including subfolders to the target location

```csharp
public static void CopyAll(this string sourcePath, string targetPath)
public static void CopyAll(this string sourcePath, string targetPath,
Func<string, MessageBoxResult> messageBoxExShow = null)
```

| parameter | description |
| --- | --- |
| sourcePath | |
| targetPath | |
| messageBoxExShow | |

## See Also

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# FilesFolders.EnsureTrailingSlash method

Returns path ended with "\"

```csharp
public static string EnsureTrailingSlash(this string path)
```

| parameter | description |
| --- | --- |
| path | |

## See Also

* class [FilesFolders](../FilesFolders.md)
* namespace [Flow.Launcher.Plugin.SharedCommands](../../Flow.Launcher.Plugin.md)

<!-- DO NOT EDIT: generated by xmldocmd for Flow.Launcher.Plugin.dll -->
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# FilesFolders.FileExists method

Checks if a file exists

```csharp
public static bool FileExists(this string filePath)
```

| parameter | description |
| --- | --- |
| filePath | |

## See Also

* class [FilesFolders](../FilesFolders.md)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# FilesFolders.FileOrLocationExists method

Checks if a file or directory exists

```csharp
public static bool FileOrLocationExists(this string path)
```

| parameter | description |
| --- | --- |
| path | |

## See Also

* class [FilesFolders](../FilesFolders.md)
* namespace [Flow.Launcher.Plugin.SharedCommands](../../Flow.Launcher.Plugin.md)

<!-- DO NOT EDIT: generated by xmldocmd for Flow.Launcher.Plugin.dll -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# FilesFolders.IsZipFilePath method

This checks whether a given string is a zip file path. By default does not check if the zip file actually exist on disk, can do so by setting checkFileExists = true.

```csharp
public static bool IsZipFilePath(string querySearchString, bool checkFileExists = false)
```

## See Also

* class [FilesFolders](../FilesFolders.md)
* namespace [Flow.Launcher.Plugin.SharedCommands](../../Flow.Launcher.Plugin.md)

<!-- DO NOT EDIT: generated by xmldocmd for Flow.Launcher.Plugin.dll -->
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# FilesFolders.LocationExists method

Checks if a directory exists

```csharp
public static bool LocationExists(this string path)
```

| parameter | description |
| --- | --- |
| path | |

## See Also

* class [FilesFolders](../FilesFolders.md)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# FilesFolders.OpenFile method

Open a file with associated application

```csharp
public static void OpenFile(string filePath, string workingDir = "", bool asAdmin = false,
Func<string, MessageBoxResult> messageBoxExShow = null)
```

| parameter | description |
| --- | --- |
| filePath | File path |
| workingDir | Working directory |
| asAdmin | Open as Administrator |
| messageBoxExShow | |

## See Also

* class [FilesFolders](../FilesFolders.md)
* namespace [Flow.Launcher.Plugin.SharedCommands](../../Flow.Launcher.Plugin.md)

<!-- DO NOT EDIT: generated by xmldocmd for Flow.Launcher.Plugin.dll -->
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
# FilesFolders.OpenPath method

Open a directory window (using the OS's default handler, usually explorer)

```csharp
public static void OpenPath(string fileOrFolderPath)
public static void OpenPath(string fileOrFolderPath,
Func<string, MessageBoxResult> messageBoxExShow = null)
```

| parameter | description |
| --- | --- |
| fileOrFolderPath | |
| messageBoxExShow | |

## See Also

* class [FilesFolders](../FilesFolders.md)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# FilesFolders.PathContains method

Returns if *parentPath* contains *subPath*. Equal paths are not considered to be contained by default. From https://stackoverflow.com/a/66877016

```csharp
public static bool PathContains(string parentPath, string subPath, bool allowEqual = false)
```

| parameter | description |
| --- | --- |
| parentPath | Parent path |
| subPath | Sub path |
| allowEqual | If `true`, when *parentPath* and *subPath* are equal, returns `true` |

## See Also

* class [FilesFolders](../FilesFolders.md)
* namespace [Flow.Launcher.Plugin.SharedCommands](../../Flow.Launcher.Plugin.md)

<!-- DO NOT EDIT: generated by xmldocmd for Flow.Launcher.Plugin.dll -->
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
# FilesFolders.RemoveFolderIfExists method

Deletes a folder if it exists

```csharp
public static void RemoveFolderIfExists(this string path)
public static void RemoveFolderIfExists(this string path,
Func<string, MessageBoxResult> messageBoxExShow = null)
```

| parameter | description |
| --- | --- |
| path | |
| messageBoxExShow | |

## See Also

* class [FilesFolders](../FilesFolders.md)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# FilesFolders.ResolveAbsolutePath method

Resolves a path that may be relative to an absolute path. If the path is already absolute, returns it as-is. If the path is not rooted (as determined by String)), resolves it relative to ProgramDirectory.

```csharp
public static string ResolveAbsolutePath(string path)
```

| parameter | description |
| --- | --- |
| path | The path to resolve |

## Return Value

An absolute path

## See Also

* class [FilesFolders](../FilesFolders.md)
* namespace [Flow.Launcher.Plugin.SharedCommands](../../Flow.Launcher.Plugin.md)

<!-- DO NOT EDIT: generated by xmldocmd for Flow.Launcher.Plugin.dll -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# FilesFolders.TryDeleteDirectoryRobust method

Attempts to delete a directory robustly with retry logic for locked files. This method tries to delete files individually with retries, then removes empty directories. Returns true if the directory was completely deleted, false if some files/folders remain.

```csharp
public static bool TryDeleteDirectoryRobust(string path, int maxRetries = 3, int retryDelayMs = 100)
```

| parameter | description |
| --- | --- |
| path | The directory path to delete |
| maxRetries | Maximum number of retry attempts for locked files (default: 3) |
| retryDelayMs | Delay in milliseconds between retries (default: 100ms) |

## Return Value

True if directory was fully deleted, false if some items remain

## See Also

* class [FilesFolders](../FilesFolders.md)
* namespace [Flow.Launcher.Plugin.SharedCommands](../../Flow.Launcher.Plugin.md)

<!-- DO NOT EDIT: generated by xmldocmd for Flow.Launcher.Plugin.dll -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# FilesFolders.ValidateDataDirectory method

Validates a data directory, synchronizing it by ensuring all files from a bundled source directory exist in it. If files are missing or outdated, they are copied from the bundled directory to the data directory.

```csharp
public static void ValidateDataDirectory(string bundledDataDirectory, string dataDirectory)
```

| parameter | description |
| --- | --- |
| bundledDataDirectory | |
| dataDirectory | |

## See Also

* class [FilesFolders](../FilesFolders.md)
* namespace [Flow.Launcher.Plugin.SharedCommands](../../Flow.Launcher.Plugin.md)

<!-- DO NOT EDIT: generated by xmldocmd for Flow.Launcher.Plugin.dll -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# FilesFolders.ValidateDirectory method

Validates a directory, creating it if it doesn't exist

```csharp
public static void ValidateDirectory(string path)
```

| parameter | description |
| --- | --- |
| path | |

## See Also

* class [FilesFolders](../FilesFolders.md)
* namespace [Flow.Launcher.Plugin.SharedCommands](../../Flow.Launcher.Plugin.md)

<!-- DO NOT EDIT: generated by xmldocmd for Flow.Launcher.Plugin.dll -->
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
# FilesFolders.VerifyBothFolderFilesEqual method

Check if the files and directories are identical between *fromPath* and *toPath*

```csharp
public static bool VerifyBothFolderFilesEqual(this string fromPath, string toPath)
public static bool VerifyBothFolderFilesEqual(this string fromPath, string toPath,
Func<string, MessageBoxResult> messageBoxExShow = null)
```

| parameter | description |
| --- | --- |
| fromPath | |
| toPath | |
| messageBoxExShow | |

## See Also

* class [FilesFolders](../FilesFolders.md)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# SearchWeb class

Contains methods to open a search in a new browser window or tab.

```csharp
public static class SearchWeb
```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# ShellCommand.EnumThreadDelegate delegate

Delegate for EnumThreadWindows

```csharp
public delegate bool EnumThreadDelegate(IntPtr hwnd, IntPtr lParam);
```

| parameter | description |
| --- | --- |
| hwnd | |
| lParam | |

## See Also

* class [ShellCommand](./ShellCommand.md)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# ShellCommand class

Contains methods for running shell commands

```csharp
public static class ShellCommand
```
Expand All @@ -9,9 +11,9 @@ public static class ShellCommand
| name | description |
| --- | --- |
| static [Execute](ShellCommand/Execute.md)(…) | Runs a windows command using the provided ProcessStartInfo (2 methods) |
| static [RunAsDifferentUser](ShellCommand/RunAsDifferentUser.md)(…) | |
| static [SetProcessStartInfo](ShellCommand/SetProcessStartInfo.md)(…) | |
| delegate [EnumThreadDelegate](ShellCommand.EnumThreadDelegate.md) | |
| static [RunAsDifferentUser](ShellCommand/RunAsDifferentUser.md)(…) | Runs a windows command using the provided ProcessStartInfo |
| static [SetProcessStartInfo](ShellCommand/SetProcessStartInfo.md)(…) | Runs a windows command using the provided ProcessStartInfo |
| delegate [EnumThreadDelegate](ShellCommand.EnumThreadDelegate.md) | Delegate for EnumThreadWindows |

## See Also

Expand Down
Loading