diff options
author | Bardur Arantsson <bardur@scientician.net> | 2016-02-05 19:22:46 +0100 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2016-02-05 19:22:46 +0100 |
commit | b1a9e6028d66a47a5205225401db312c929b089c (patch) | |
tree | 902c8c548f9c366423d4baf50fb1266b1ae67ba8 /src/util.cc | |
parent | 5fd7124695ff1a3f8a6e019dc301ed48e5e067d4 (diff) |
Remove path_temp in favor of boost::fs::unique_path()
This gets rid of one #ifdef WINDOWS hack at least.
Diffstat (limited to 'src/util.cc')
-rw-r--r-- | src/util.cc | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/src/util.cc b/src/util.cc index b7863f1a..8bdd532d 100644 --- a/src/util.cc +++ b/src/util.cc @@ -71,8 +71,6 @@ void user_name(char *buf, int id) * to assume that all filenames are "Unix" filenames, and explicitly "extract" * such filenames if needed (by "path_parse()", or perhaps "path_canon()"). * -* Note that "path_temp" should probably return a "canonical" filename. -* * Note that "my_fopen()" and "my_open()" and "my_make()" and "my_kill()" * and "my_move()" and "my_copy()" should all take "canonical" filenames. * @@ -170,42 +168,6 @@ errr path_parse(char *buf, int max, cptr file) /* -* Hack -- acquire a "temporary" file name if possible -* -* This filename is always in "system-specific" form. -*/ -errr path_temp(char *buf, int max) -{ -#ifdef WINDOWS - static u32b tmp_counter; - static char valid_characters[] = - "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; - char rand_ext[4]; - - rand_ext[0] = valid_characters[rand_int(sizeof (valid_characters))]; - rand_ext[1] = valid_characters[rand_int(sizeof (valid_characters))]; - rand_ext[2] = valid_characters[rand_int(sizeof (valid_characters))]; - rand_ext[3] = '\0'; - strnfmt(buf, max, "%s/t_%ud.%s", ANGBAND_DIR_XTRA, tmp_counter, rand_ext); - tmp_counter++; -#else - cptr s; - - /* Temp file */ - s = tmpnam(NULL); - - /* Oops */ - if (!s) return ( -1); - - /* Format to length */ - strnfmt(buf, max, "%s", s); -#endif - /* Success */ - return (0); -} - - -/* * Create a new path by appending a file (or directory) to a path * * This requires no special processing on simple machines, except |