add more possibilities on temporary file paths
This commit is contained in:
parent
542ba75b01
commit
aeb76fe6c0
1 changed files with 1 additions and 2 deletions
|
@ -75,7 +75,7 @@ pub fn sseek(file: *c.SNDFILE, offset: usize) void {
|
||||||
/// Caller owns the returned memory.
|
/// Caller owns the returned memory.
|
||||||
pub fn temporaryName(allocator: *std.mem.Allocator) ![]u8 {
|
pub fn temporaryName(allocator: *std.mem.Allocator) ![]u8 {
|
||||||
const template_start = "/temp/temp_";
|
const template_start = "/temp/temp_";
|
||||||
const template = "/tmp/temp_XXXXXXXXXXX";
|
const template = "/tmp/temp_XXXXXXXXXXXXXXXXXXXXX";
|
||||||
var nam = try allocator.alloc(u8, template.len);
|
var nam = try allocator.alloc(u8, template.len);
|
||||||
std.mem.copy(u8, nam, template);
|
std.mem.copy(u8, nam, template);
|
||||||
|
|
||||||
|
@ -86,7 +86,6 @@ pub fn temporaryName(allocator: *std.mem.Allocator) ![]u8 {
|
||||||
|
|
||||||
var i: usize = 0;
|
var i: usize = 0;
|
||||||
while (i < 100) : (i += 1) {
|
while (i < 100) : (i += 1) {
|
||||||
|
|
||||||
// generate a random uppercase letter, that is, 65 + random number.
|
// generate a random uppercase letter, that is, 65 + random number.
|
||||||
for (fill) |_, f_idx| {
|
for (fill) |_, f_idx| {
|
||||||
var idx = @intCast(u8, r.random.uintLessThan(u5, 24));
|
var idx = @intCast(u8, r.random.uintLessThan(u5, 24));
|
||||||
|
|
Loading…
Reference in a new issue