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