I need to retrieve and deserialize JSON file as part of the program. I suppose it wouldn't be good practice to manually copy and paste the path. In most tutorials I see something similar to the code snippet below for accessing the file.
var currentDirectory = Directory.GetCurrentDirectory();var jsonFilePath = Path.Combine(currentDirectory, "Data","Tasks.json");
var currentDirectory = Directory.GetCurrentDirectory();var jsonFilePath = Path.Combine(currentDirectory, "Data","Tasks.json");
for me GetCurrentDirecory() method returns following path: "~\source\repos\TaskTrackerCLI\TaskTrackerCLI\bin\Debug\net8.0" the Tasks.json file is inside Data folder, which is inside the project folder, as it should be.
Can anyone tell me how I should retrieve the file, what am I doing wrong?