diff --git a/Source/v2/Meadow.Cli/Commands/Current/Cloud/Package/CloudPackageCreateCommand.cs b/Source/v2/Meadow.Cli/Commands/Current/Cloud/Package/CloudPackageCreateCommand.cs index 9d9ab178..441234d0 100644 --- a/Source/v2/Meadow.Cli/Commands/Current/Cloud/Package/CloudPackageCreateCommand.cs +++ b/Source/v2/Meadow.Cli/Commands/Current/Cloud/Package/CloudPackageCreateCommand.cs @@ -43,6 +43,11 @@ public CloudPackageCreateCommand( protected override async ValueTask ExecuteCommand() { ProjectPath ??= AppDomain.CurrentDomain.BaseDirectory; + ProjectPath = Path.GetFullPath(ProjectPath); + if (!Directory.Exists(ProjectPath)) + { + throw new DirectoryNotFoundException($"Directory not found '{ProjectPath}'. Check path to project file."); + } // build Logger?.LogInformation($"Building {Configuration} version of application..."); diff --git a/Source/v2/Meadow.Package/PackageManager.cs b/Source/v2/Meadow.Package/PackageManager.cs index af8dddf5..70a664b6 100644 --- a/Source/v2/Meadow.Package/PackageManager.cs +++ b/Source/v2/Meadow.Package/PackageManager.cs @@ -4,7 +4,9 @@ using Meadow.Software; using System.Diagnostics; using System.Globalization; +using System.IO; using System.IO.Compression; +using System.Reflection; using System.Runtime.InteropServices; using System.Text.Json; using YamlDotNet.Serialization; @@ -227,7 +229,8 @@ private void CreateEntry(ZipArchive archive, string fromFile, string entryPath) public static FileInfo[] GetAvailableBuiltConfigurations(string rootFolder, string appName = "App.dll") { - if (!Directory.Exists(rootFolder)) { throw new FileNotFoundException(); } + rootFolder = Path.GetFullPath(rootFolder); + if (!Directory.Exists(rootFolder)) { throw new DirectoryNotFoundException($"Directory not found '{rootFolder}'. Check path to project file."); } //see if this is a fully qualified path to the app.dll if (File.Exists(Path.Combine(rootFolder, appName))) @@ -237,7 +240,7 @@ public static FileInfo[] GetAvailableBuiltConfigurations(string rootFolder, stri // look for a 'bin' folder var path = Path.Combine(rootFolder, "bin"); - if (!Directory.Exists(path)) throw new FileNotFoundException($"No 'bin' directory found under {rootFolder}. Have you compiled?"); + if (!Directory.Exists(path)) throw new DirectoryNotFoundException($"No 'bin' directory found under '{rootFolder}'. Have you compiled?"); var files = new List(); FindApp(path, files);