Skip to content

Commit

Permalink
Merge pull request #790 from hargata/Hargata/769
Browse files Browse the repository at this point in the history
moved userConfig file into data folder.
  • Loading branch information
hargata authored Jan 9, 2025
2 parents bb019cb + 519f159 commit 140506c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
bin/
obj/
data/
config/userConfig.json
CarCareTracker.csproj.user
Properties/launchSettings.json
1 change: 1 addition & 0 deletions Controllers/APIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1223,6 +1223,7 @@ public IActionResult UploadDocument(List<IFormFile> documents)
return Json(uploadedFiles);
} else
{
Response.StatusCode = 400;
return Json(OperationResponse.Failed("No files to upload"));
}
}
Expand Down
19 changes: 12 additions & 7 deletions Helper/StaticHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static class StaticHelper
{
public const string VersionNumber = "1.4.3";
public const string DbName = "data/cartracker.db";
public const string UserConfigPath = "config/userConfig.json";
public const string UserConfigPath = "data/config/userConfig.json";
public const string AdditionalWidgetsPath = "data/widgets.html";
public const string GenericErrorMessage = "An error occurred, please try again later";
public const string ReminderEmailTemplate = "defaults/reminderemailtemplate.txt";
Expand Down Expand Up @@ -326,8 +326,8 @@ public static void InitMessage(IConfiguration config)
//Create folders if they don't exist.
if (!Directory.Exists("data"))
{
Console.WriteLine("Created data directory");
Directory.CreateDirectory("data");
Console.WriteLine("Created data directory");
}
if (!Directory.Exists("data/images"))
{
Expand All @@ -336,22 +336,22 @@ public static void InitMessage(IConfiguration config)
}
if (!Directory.Exists("data/documents"))
{
Console.WriteLine("Created documents directory");
Directory.CreateDirectory("data/documents");
Console.WriteLine("Created documents directory");
}
if (!Directory.Exists("data/translations"))
{
Console.WriteLine("Created translations directory");
Directory.CreateDirectory("data/translations");
Console.WriteLine("Created translations directory");
}
if (!Directory.Exists("data/temp"))
{
Console.WriteLine("Created translations directory");
Directory.CreateDirectory("data/temp");
Console.WriteLine("Created translations directory");
}
if (!Directory.Exists("config"))
if (!Directory.Exists("data/config"))
{
Directory.CreateDirectory("config");
Directory.CreateDirectory("data/config");
Console.WriteLine("Created config directory");
}
}
Expand All @@ -363,6 +363,11 @@ public static void CheckMigration(string webRootPath)
var docsPath = Path.Combine(webRootPath, "documents");
var translationPath = Path.Combine(webRootPath, "translations");
var tempPath = Path.Combine(webRootPath, "temp");
var configPath = "config/userConfig.json";
if (File.Exists(configPath))
{
File.Move(configPath, UserConfigPath, true);
}
if (Directory.Exists(imagePath))
{
foreach (string fileToMove in Directory.GetFiles(imagePath))
Expand Down

0 comments on commit 140506c

Please sign in to comment.