change folder path naming
This commit is contained in:
parent
ac13770ce0
commit
8b04e4efd2
@ -2,17 +2,17 @@
|
||||
{
|
||||
public class FileNoteService : INoteService
|
||||
{
|
||||
private readonly string filePath;
|
||||
private readonly string folderPath;
|
||||
|
||||
private static readonly string defaultFilePath = "notes";
|
||||
private static readonly string defaultFolderPath = "notes";
|
||||
|
||||
public FileNoteService(IConfiguration configuration)
|
||||
{
|
||||
filePath = configuration["FileNoteService:ContentFilePath"];
|
||||
folderPath = configuration["FileNoteService:ContentFolder"];
|
||||
|
||||
if (string.IsNullOrWhiteSpace(filePath))
|
||||
if (string.IsNullOrWhiteSpace(folderPath))
|
||||
{
|
||||
filePath = defaultFilePath;
|
||||
folderPath = defaultFolderPath;
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
public ICollection<string> GetNoteNames()
|
||||
{
|
||||
return Directory.GetFiles(filePath)
|
||||
return Directory.GetFiles(folderPath)
|
||||
.Select(f => Path.GetFileName(f))
|
||||
.ToList();
|
||||
}
|
||||
@ -49,6 +49,8 @@
|
||||
// ensure initialized
|
||||
if (!File.Exists(filePath))
|
||||
{
|
||||
Directory.CreateDirectory(folderPath);
|
||||
|
||||
SaveText("Hi! Feel free to start typing. Everything will be saved soon after you are done typing.", noteName);
|
||||
}
|
||||
}
|
||||
@ -57,7 +59,7 @@
|
||||
{
|
||||
noteName = noteName.Trim().ToLower();
|
||||
|
||||
return Path.Combine(filePath, noteName);
|
||||
return Path.Combine(folderPath, noteName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,6 @@
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"FileNoteService": {
|
||||
"ContentFilePath": "notes"
|
||||
"ContentFolder": "notes"
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user