when working on a project, I, like most people I suppose, save all my data files and do-file under a well structured project directory. At the beginning of each do-file, I change the working directory to my project directory and read and write all files there.
When collaborating with others on a project, it's usually necessary to send the whole project folder to other people, and most likely they would save the project folder at some directory path different from mine. for example,
In that case, they would have to change the working directory in each do-file for it to run smoothly.
Is there any way to run the do-files without changing the directory explicitly? Ideally when they get the project folder, they can just open the do-file and run it, without changing anything.
What I can think of is at the beginning of the do-file, the do-file somehow gets the path of the do-file and then somehow change all the other paths accordingly. I just don't know how this can be realized. Since the problem is so ubiquitous, I guess there should already be a solution to this? Is it possible to get rid of the absolute paths altogether?
Code:
cd "c/Documents/project"
Code:
D/My Projects/project
Is there any way to run the do-files without changing the directory explicitly? Ideally when they get the project folder, they can just open the do-file and run it, without changing anything.
What I can think of is at the beginning of the do-file, the do-file somehow gets the path of the do-file and then somehow change all the other paths accordingly. I just don't know how this can be realized. Since the problem is so ubiquitous, I guess there should already be a solution to this? Is it possible to get rid of the absolute paths altogether?
Comment