Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.0.55 #588

Merged
merged 6 commits into from
Aug 6, 2024
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions Source/v2/Meadow.CLI/Commands/Current/App/AppTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ namespace Meadow.CLI.Commands.DeviceManagement;

internal static class AppTools
{
internal const string MeadowRootFolder = "meadow0";

internal static string ValidateAndSanitizeAppPath(string? path)
{
path ??= Directory.GetCurrentDirectory();
Expand Down Expand Up @@ -124,15 +122,15 @@ internal static string SanitizeMeadowFilename(string fileName)

if (string.IsNullOrWhiteSpace(folder))
{
folder = Path.DirectorySeparatorChar + MeadowRootFolder;
folder = Path.DirectorySeparatorChar + AppManager.MeadowRootFolder;
}
else
{
if (!folder.StartsWith(Path.DirectorySeparatorChar))
{
if (!folder.StartsWith($"{MeadowRootFolder}"))
if (!folder.StartsWith($"{AppManager.MeadowRootFolder}"))
{
folder = $"{Path.DirectorySeparatorChar}{MeadowRootFolder}{Path.DirectorySeparatorChar}{folder}";
folder = $"{Path.DirectorySeparatorChar}{AppManager.MeadowRootFolder}{Path.DirectorySeparatorChar}{folder}";
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ protected override async ValueTask ExecuteCommand()
private async Task DeleteFileRecursive(IMeadowDevice device, string directoryname, MeadowFileInfo fileInfo, CancellationToken cancellationToken)
{
var meadowFile = AppTools.SanitizeMeadowFilename(Path.Combine(directoryname, fileInfo.Name));

foreach (var folder in AppManager.PersistantFolders)
{
if (meadowFile.StartsWith($"/{AppManager.MeadowRootFolder}/{folder}"))
{
return;
}
}

if (fileInfo.IsDirectory)
{
// Add a backslash as we're a directory and not a file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected override async ValueTask ExecuteCommand()
Logger?.LogInformation($"Getting file list...");
}

var files = await device.GetFileList(Folder ?? $"/{AppTools.MeadowRootFolder}/", Verbose, CancellationToken);
var files = await device.GetFileList(Folder ?? $"/{AppManager.MeadowRootFolder}/", Verbose, CancellationToken);

if (files == null || files.Length == 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ protected override async ValueTask ExecuteCommand()
}
else
{
await connection!.Device!.WriteFile(osFileWithoutBootloader, $"/{AppTools.MeadowRootFolder}/update/os/{package.OsWithoutBootloader}");
await connection!.Device!.WriteFile(osFileWithoutBootloader, $"/{AppManager.MeadowRootFolder}/update/os/{package.OsWithoutBootloader}");
}
}

Expand Down Expand Up @@ -361,7 +361,7 @@ private async Task<IMeadowConnection> FindMeadowConnection(IList<string> portsTo
}
else
{
await connection.Device!.WriteFile(runtimePath, $"/{AppTools.MeadowRootFolder}/update/os/{destinationFilename}");
await connection.Device!.WriteFile(runtimePath, $"/{AppManager.MeadowRootFolder}/update/os/{destinationFilename}");
}

return connection;
Expand Down Expand Up @@ -403,7 +403,7 @@ private async Task WriteEspFiles(IMeadowConnection? connection, DeviceInfo? devi
{
foreach (var file in fileList)
{
await connection!.Device!.WriteFile(file, $"/{AppTools.MeadowRootFolder}/update/os/{Path.GetFileName(file)}");
await connection!.Device!.WriteFile(file, $"/{AppManager.MeadowRootFolder}/update/os/{Path.GetFileName(file)}");
await Task.Delay(500);
}
}
Expand Down
16 changes: 0 additions & 16 deletions Source/v2/Meadow.Cli/Commands/Legacy/DownloadOsCommand.cs

This file was deleted.

20 changes: 0 additions & 20 deletions Source/v2/Meadow.Cli/Commands/Legacy/FlashOsCommand.cs

This file was deleted.

14 changes: 0 additions & 14 deletions Source/v2/Meadow.Cli/Commands/Legacy/InstallDfuCommand.cs

This file was deleted.

19 changes: 0 additions & 19 deletions Source/v2/Meadow.Cli/Commands/Legacy/ListPortsCommand.cs

This file was deleted.

14 changes: 0 additions & 14 deletions Source/v2/Meadow.Cli/Commands/Legacy/MonoDisableCommand.cs

This file was deleted.

14 changes: 0 additions & 14 deletions Source/v2/Meadow.Cli/Commands/Legacy/MonoEnableCommand.cs

This file was deleted.

14 changes: 0 additions & 14 deletions Source/v2/Meadow.Cli/Commands/Legacy/MonoStateCommand.cs

This file was deleted.

28 changes: 0 additions & 28 deletions Source/v2/Meadow.Cli/Commands/Legacy/UsePortCommand.cs

This file was deleted.

2 changes: 1 addition & 1 deletion Source/v2/Meadow.Cli/Meadow.CLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Authors>Wilderness Labs, Inc</Authors>
<Company>Wilderness Labs, Inc</Company>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageVersion>2.0.54.0</PackageVersion>
<PackageVersion>2.0.55.0</PackageVersion>
<Platforms>AnyCPU</Platforms>
<PackageProjectUrl>http://developer.wildernesslabs.co/Meadow/Meadow.CLI/</PackageProjectUrl>
<RepositoryUrl>https://github.com/WildernessLabs/Meadow.CLI</RepositoryUrl>
Expand Down
2 changes: 1 addition & 1 deletion Source/v2/Meadow.Cli/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ namespace Meadow.CLI;

public static class Constants
{
public const string CLI_VERSION = "2.0.54.0";
public const string CLI_VERSION = "2.0.55.0";
}
12 changes: 9 additions & 3 deletions Source/v2/Meadow.Tooling.Core/App/AppManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ namespace Meadow.CLI;

public static class AppManager
{
static readonly string MeadowRootFolder = "meadow0";
public static readonly string MeadowRootFolder = "meadow0";

static readonly string[] PersistantFolders = new string[]
public static readonly string[] PersistantFolders = new string[]
{
"Data",
"Documents",
"update-store",
"system",
};

private static bool MatchingDllExists(string file)
Expand Down Expand Up @@ -132,8 +133,13 @@ public static async Task DeployApplication(
// delete those files
foreach (var file in removeFiles)
{
if (PersistantFolders.Contains(file.Path))
{
continue;
}

logger?.LogInformation($"Deleting '{file}'");
var folder = string.IsNullOrEmpty(file.Path) ? $"/{MeadowRootFolder}/" : $"{file.Path}";
var folder = string.IsNullOrEmpty(file.Path) ? $"/{MeadowRootFolder}/" : $"/{MeadowRootFolder}/{file.Path}/";

await connection.DeleteFile($"{folder}{file.Name}", cancellationToken);
}
Expand Down
Loading