Skip to content

Conversation

garslo
Copy link

@garslo garslo commented Jul 22, 2011

Append random string of numbers to temporary .rdmd directory (see Issue 6172).

@kennytm
Copy link

kennytm commented Jul 22, 2011

Why not use mkstemp?

@garslo
Copy link
Author

garslo commented Jul 22, 2011

mkstemp hadn't occurred to me, however sticking to D seems far simpler. Also, the additional overhead of a Random() seems unimportant, especially since that portion is run only once.

@kennytm
Copy link

kennytm commented Jul 22, 2011

It's not just a problem of simplicity, but correctness. Random does not guarantee /tmp/.rdmd.[random] doesn't exist. Actually I should say mkdtemp, as mkstemp creates a file, not a directory.

And Phobos should add support for these functions in std.stdio or std.file.

@dnadlinger
Copy link
Contributor

And Phobos should add support for these functions in std.stdio or std.file.

Yes, definitely, I was surprised to learn that we don't have something like that (there is File.tmpfile, but it's limited and can't be used with directories).

@garslo
Copy link
Author

garslo commented Jul 22, 2011

Thanks for the critique, kennytm. Maybe this should wait until Phobos integrates has the indicated functions.

@garslo garslo closed this Jul 23, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants