Closed patchthecode closed 6 years ago
Yes, that is definitely a valid concern. You work around it by using custom contexts instead of ‘main’, maybe one per thread:
var context = CustomContext(main)
context.currentdirectory = ...
context.run(...)
You can also change other properties of the contexts like environment variables and their input and outputs. Also be aware that when you change the current directory of ‘main’ it also affects some Foundation classes like URL.
Awesome, i didnt know you could do that. thanks again. closing this.
I'm not sure if this might be a problem, but i'm asking before i code it. I might have multiple threads running, and they may change the directory before running other commands. It would be bad if changing the directory changes it for the entire application because there will be conflicts on different threads.
Is my concern valid? Thanks.