From 1a9778087c5694967abf6361d63771b4810cb111 Mon Sep 17 00:00:00 2001 From: nvisionative Date: Wed, 24 Apr 2019 10:21:25 -0400 Subject: [PATCH] Resolve Error: Could not find part of path (#221) --- nvQuickSite/Controllers/PackageController.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/nvQuickSite/Controllers/PackageController.cs b/nvQuickSite/Controllers/PackageController.cs index 73292a7a..9dd023bf 100644 --- a/nvQuickSite/Controllers/PackageController.cs +++ b/nvQuickSite/Controllers/PackageController.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Net; +using System.IO; using System.Reflection; namespace nvQuickSite.Controllers @@ -30,6 +31,12 @@ public static IEnumerable GetPackageList() } private static void SaveLocalPackagesFile(IEnumerable packages) { + var downloadDirectory = GetDownloadDirectory(); + if (!Directory.Exists(downloadDirectory)) + { + Directory.CreateDirectory(downloadDirectory); + } + var pfile = System.IO.Directory.GetCurrentDirectory() + @"\Downloads\packages.json"; using (var sw = new System.IO.StreamWriter(pfile)) { @@ -66,5 +73,10 @@ private static IEnumerable GetRemotePackages() return new List(); } + private static string GetDownloadDirectory() + { + return Directory.GetCurrentDirectory() + @"\Downloads\"; + } + } } \ No newline at end of file