You have common options:
- Save the directory path in the configuration file (you said you did not want to do this)
- Ask the user to enter a relative path (.... \ MyFile.txt)
- Programmatically searching for files matching the name (very slow and prone to finding multiple files with the same name)
- Suppose the data file is in the executing directory
In any case, you cut it, the user must specify the path to the directory, whether in the configuration file, enter the relative path or select from the list of files with the same names in different directories.
ANALOGUE: You place a textbook in a locker, somewhere in a school. You ask your friend to take the book from the โlockerโ, not hinting what kind of locker may be. You have to wait a very long time and eventually get 50 similar books. Or indicate the key to the entrance hall, the locker bank and / or the locker number in which the book can be stored. The uncertainty of your prompt directly correlates with the response time and the potential for returning several possibilities.
Mike christian
source share