@@ -105,7 +105,7 @@ fn installVersion(
105105 const archive_name = if (std .mem .lastIndexOfScalar (u8 , tar_url , '/' )) | idx | tar_url [idx + 1 .. ] else "zig-archive" ;
106106
107107 var archive_path_buf : [std .fs .max_path_bytes * 2 ]u8 = undefined ;
108- const archive_path = try std .fmt .bufPrint (& archive_path_buf , "{s}/{s}" , .{ zvm .base_dir , archive_name });
108+ const archive_path = try std .fmt .bufPrint (& archive_path_buf , "{s}/{s}" , .{ zvm .cache_dir , archive_name });
109109
110110 // Download archive (with optional mirror support)
111111 try stdout .print ("Downloading Zig {s}...\n " , .{version });
@@ -151,7 +151,7 @@ fn installVersion(
151151 try stdout .print ("Extracting...\n " , .{});
152152 try stdout .flush ();
153153
154- archive .extractArchive (allocator , zvm .io , archive_path , zvm .base_dir ) catch {
154+ archive .extractArchive (allocator , zvm .io , archive_path , zvm .data_dir ) catch {
155155 try terminal .printError (stderr , "Failed to extract archive" );
156156 return error .ExtractionFailed ;
157157 };
@@ -218,7 +218,7 @@ fn renameExtractedDir(
218218 const arch_part = target [0.. dash_idx ];
219219 const os_part = target [dash_idx + 1 .. ];
220220
221- var dir = std .Io .Dir .cwd ().openDir (zvm .io , zvm .base_dir , .{ .iterate = true }) catch return ;
221+ var dir = std .Io .Dir .cwd ().openDir (zvm .io , zvm .data_dir , .{ .iterate = true }) catch return ;
222222 defer dir .close (zvm .io );
223223
224224 var found : ? []const u8 = null ;
@@ -251,15 +251,15 @@ fn renameExtractedDir(
251251
252252/// Remove any leftover zig-* directories from failed or interrupted extractions.
253253fn cleanupExtractedDirs (zvm : * zvm_mod.ZVM ) void {
254- var dir = std .Io .Dir .cwd ().openDir (zvm .io , zvm .base_dir , .{ .iterate = true }) catch return ;
254+ var dir = std .Io .Dir .cwd ().openDir (zvm .io , zvm .data_dir , .{ .iterate = true }) catch return ;
255255 defer dir .close (zvm .io );
256256
257257 var iter = dir .iterate ();
258258 while (iter .next (zvm .io ) catch return ) | entry | {
259259 if (entry .kind != .directory ) continue ;
260260 if (std .mem .startsWith (u8 , entry .name , "zig-" )) {
261261 var buf : [std .fs .max_path_bytes * 2 ]u8 = undefined ;
262- const path = std .fmt .bufPrint (& buf , "{s}/{s}" , .{ zvm .base_dir , entry .name }) catch continue ;
262+ const path = std .fmt .bufPrint (& buf , "{s}/{s}" , .{ zvm .data_dir , entry .name }) catch continue ;
263263 std .Io .Dir .cwd ().deleteTree (zvm .io , path ) catch {};
264264 }
265265 }
@@ -278,9 +278,9 @@ fn verifyInstall(
278278 const zig_path = try std .fmt .allocPrint (allocator , "{s}/zig" , .{ver_path });
279279 defer allocator .free (zig_path );
280280
281- // Create a temporary test file in the zvm base directory
281+ // Create a temporary test file in the cache directory
282282 var test_buf : [std .fs .max_path_bytes * 2 ]u8 = undefined ;
283- const test_path = try std .fmt .bufPrint (& test_buf , "{s}/_zvm_smoke_test.zig" , .{zvm .base_dir });
283+ const test_path = try std .fmt .bufPrint (& test_buf , "{s}/_zvm_smoke_test.zig" , .{zvm .cache_dir });
284284 defer std .Io .Dir .cwd ().deleteFile (zvm .io , test_path ) catch {};
285285
286286 const test_file = try std .Io .Dir .cwd ().createFile (zvm .io , test_path , .{});
@@ -407,13 +407,13 @@ fn installZls(
407407 const zls_archive_name = if (std .mem .lastIndexOfScalar (u8 , zls_tarball , '/' )) | idx | zls_tarball [idx + 1 .. ] else "zls-archive" ;
408408
409409 var archive_buf : [std .fs .max_path_bytes * 2 ]u8 = undefined ;
410- const zls_archive_path = try std .fmt .bufPrint (& archive_buf , "{s}/{s}" , .{ zvm .base_dir , zls_archive_name });
410+ const zls_archive_path = try std .fmt .bufPrint (& archive_buf , "{s}/{s}" , .{ zvm .cache_dir , zls_archive_name });
411411
412412 try http_client .downloadToFileWithProxy (allocator , zvm .io , zvm .environ_map , zls_tarball , zls_archive_path , zvm .settings .proxy );
413413
414414 // Extract to a temporary directory
415415 var temp_buf : [std .fs .max_path_bytes * 2 ]u8 = undefined ;
416- const temp_dir = try std .fmt .bufPrint (& temp_buf , "{s}/zls-temp" , .{zvm .base_dir });
416+ const temp_dir = try std .fmt .bufPrint (& temp_buf , "{s}/zls-temp" , .{zvm .cache_dir });
417417 std .Io .Dir .cwd ().createDirPath (zvm .io , temp_dir ) catch {};
418418
419419 archive .extractArchive (allocator , zvm .io , zls_archive_path , temp_dir ) catch {
@@ -437,12 +437,12 @@ fn installZls(
437437 var inner_iter = inner_dir .iterate ();
438438 while (try inner_iter .next (zvm .io )) | inner_entry | {
439439 if (std .mem .eql (u8 , inner_entry .name , "zls" ) or std .mem .eql (u8 , inner_entry .name , "zls.exe" )) {
440- // Copy the zls binary to ~/.zvm /<version>/zls
440+ // Copy the zls binary to data_dir /<version>/zls
441441 var src_buf : [std .fs .max_path_bytes * 2 ]u8 = undefined ;
442442 const src = try std .fmt .bufPrint (& src_buf , "{s}/{s}/{s}" , .{ temp_dir , entry .name , inner_entry .name });
443443
444444 var dst_buf : [std .fs .max_path_bytes * 2 ]u8 = undefined ;
445- const dst = try std .fmt .bufPrint (& dst_buf , "{s}/{s}/zls" , .{ zvm .base_dir , version });
445+ const dst = try std .fmt .bufPrint (& dst_buf , "{s}/{s}/zls" , .{ zvm .data_dir , version });
446446
447447 const src_file = std .Io .Dir .cwd ().openFile (zvm .io , src , .{}) catch continue ;
448448 defer src_file .close (zvm .io );
0 commit comments