| ... | @@ -249,14 +249,14 @@ pub fn fetchAndAddDependencies( | ... | @@ -249,14 +249,14 @@ pub fn fetchAndAddDependencies( |
| 249 | | 249 | |
| 250 | pub fn createFilePkg( | 250 | pub fn createFilePkg( |
| 251 | gpa: Allocator, | 251 | gpa: Allocator, |
| 252 | global_cache_directory: Compilation.Directory, | 252 | cache_directory: Compilation.Directory, |
| 253 | basename: []const u8, | 253 | basename: []const u8, |
| 254 | contents: []const u8, | 254 | contents: []const u8, |
| 255 | ) !*Package { | 255 | ) !*Package { |
| 256 | const rand_int = std.crypto.random.int(u64); | 256 | const rand_int = std.crypto.random.int(u64); |
| 257 | const tmp_dir_sub_path = "tmp" ++ fs.path.sep_str ++ hex64(rand_int); | 257 | const tmp_dir_sub_path = "tmp" ++ fs.path.sep_str ++ hex64(rand_int); |
| 258 | { | 258 | { |
| 259 | var tmp_dir = try global_cache_directory.handle.makeOpenPath(tmp_dir_sub_path, .{}); | 259 | var tmp_dir = try cache_directory.handle.makeOpenPath(tmp_dir_sub_path, .{}); |
| 260 | defer tmp_dir.close(); | 260 | defer tmp_dir.close(); |
| 261 | try tmp_dir.writeFile(basename, contents); | 261 | try tmp_dir.writeFile(basename, contents); |
| 262 | } | 262 | } |
| ... | @@ -267,9 +267,9 @@ pub fn createFilePkg( | ... | @@ -267,9 +267,9 @@ pub fn createFilePkg( |
| 267 | const hex_digest = hh.final(); | 267 | const hex_digest = hh.final(); |
| 268 | | 268 | |
| 269 | const o_dir_sub_path = "o" ++ fs.path.sep_str ++ hex_digest; | 269 | const o_dir_sub_path = "o" ++ fs.path.sep_str ++ hex_digest; |
| 270 | try renameTmpIntoCache(global_cache_directory.handle, tmp_dir_sub_path, o_dir_sub_path); | 270 | try renameTmpIntoCache(cache_directory.handle, tmp_dir_sub_path, o_dir_sub_path); |
| 271 | | 271 | |
| 272 | return createWithDir(gpa, global_cache_directory, o_dir_sub_path, basename); | 272 | return createWithDir(gpa, cache_directory, o_dir_sub_path, basename); |
| 273 | } | 273 | } |
| 274 | | 274 | |
| 275 | fn fetchAndUnpack( | 275 | fn fetchAndUnpack( |
| ... | @@ -558,7 +558,7 @@ fn renameTmpIntoCache( | ... | @@ -558,7 +558,7 @@ fn renameTmpIntoCache( |
| 558 | tmp_dir_sub_path: []const u8, | 558 | tmp_dir_sub_path: []const u8, |
| 559 | dest_dir_sub_path: []const u8, | 559 | dest_dir_sub_path: []const u8, |
| 560 | ) !void { | 560 | ) !void { |
| 561 | assert(dest_dir_sub_path[1] == '/'); | 561 | assert(dest_dir_sub_path[1] == fs.path.sep); |
| 562 | var handled_missing_dir = false; | 562 | var handled_missing_dir = false; |
| 563 | while (true) { | 563 | while (true) { |
| 564 | cache_dir.rename(tmp_dir_sub_path, dest_dir_sub_path) catch |err| switch (err) { | 564 | cache_dir.rename(tmp_dir_sub_path, dest_dir_sub_path) catch |err| switch (err) { |