brandonshawfhl / Quiz-Maker

0 stars 0 forks source link

prefer relative links instead of absolutes #8

Closed incredibleLeitman closed 9 months ago

incredibleLeitman commented 9 months ago

This represents an absolute Link: https://github.com/brandonshawfhl/Quiz-Maker/blob/50673776923e5865a54d90072c775e4a9189e620/ConsoleApp3/Logic.cs#L15

but can lead to errors because people may don't have access to this specific path (for example are not allowed to access folders on C: or even have renamed their hard drive letter)

Instead you can use relative paths wich go from the current execution directory. For example, var path = @"questionAndAnswersList.xml"; will just look in the same directory as the executable is place, var path = @"..\questionAndAnswersList.xml"; will look one folder up, etc...

This also applies for the "LoadQuiz" method