Reputation: 2983
We have a web service that creates a folder structure for our projects and as part of the this I need to create a text file that has the path to the project. I've created a template text file with a dummy path that I will replace when creating the file. e.g
//XXXXXXXX/projects/
Now the question is, what is the optimal way to create the file on a network share from my template and update the path? I think I have two options:
open template file, get content as a string, replace the xxxxxxxx and then create a new text file on the network share
copy the template file to the network share, open, get the content as a string, replace the xxxxxxxx and save back
Upvotes: 0
Views: 80
Reputation: 33139
I think this question is primarily opinion-based, but here goes:
I'd go for option #1, simply because (a) the two options are not that different and do not pose any significantly different technical "challenges", and (b) with option #1 you never run into the problem of having a file that points to an illegal path.
Upvotes: 2