Comments (2)
It is possible that duplicating the directory containing
foo
and then replacing that directory with a new directory containingencrypted_foo
might do the job, but maybe there's an easier method?
Using different directories is the only way I know of. Note that you can’t atomically replace a directory, though (from rename(2)
):
oldpath can specify a directory. In this case, newpath must either not exist, or it must specify an empty directory.
One way to get around this is to use a symbolic link. I’m doing this in pgt-gopath: https://github.com/Debian/pkg-go-tools/blob/31d6c2510aace2dfbcc2699eec039da91c614cd1/cmd/pgt-gopath/gopath.go#L44
I don’t think that strategy works well for chezmoi, though, as you typically have much less control over the directory layout.
from renameio.
Thanks very much for the answer. That all makes sense.
from renameio.
Related Issues (20)
- Windows support HOT 8
- Question: fsync on file and/or directory HOT 5
- []byte vs io.Writer HOT 5
- Make it fast and easy to do multiple replacements HOT 7
- WriteFile is broken on Windows HOT 7
- symlink: don’t call os.RemoveAll twice HOT 19
- Add tips on preserving file metadata HOT 3
- TempFile: name bikeshedding HOT 5
- Request: tag new version HOT 3
- maybe: doesn't build on Windows HOT 2
- add a drop-in replacement for ioutil.WriteFile HOT 3
- Add TempFile Directoy parameter to WriteFile HOT 2
- WriteFile doesn't respect umask HOT 7
- fs.FS support? HOT 3
- Consider using O_TMPFILE HOT 1
- convert to a Go module HOT 2
- Add support for 'WithModificationTIme()' option HOT 1
- TempDir can return an unusable directory HOT 3
- Allow user to control tempfile names (plus: weird interaction with ioutil.TempFile) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from renameio.