From c83d9b9c1e83e9ea878f108a829e3c3acc42a71e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C5=8Dshin?= Date: Mon, 31 Jan 2022 14:03:34 -0600 Subject: [PATCH] unix: hard-code %put base directory --- pkg/urbit/include/vere/vere.h | 4 ++-- pkg/urbit/vere/io/term.c | 2 +- pkg/urbit/vere/io/unix.c | 14 ++++---------- pkg/urbit/vere/pier.c | 2 +- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/pkg/urbit/include/vere/vere.h b/pkg/urbit/include/vere/vere.h index 32e1cc9b5..f835c60be 100644 --- a/pkg/urbit/include/vere/vere.h +++ b/pkg/urbit/include/vere/vere.h @@ -1141,10 +1141,10 @@ /** Storage. **/ - /* u3_unix_save(): save file undir .../.urb/[bas_m] or bail. + /* u3_unix_save(): save file undir .../.urb/put or bail. */ void - u3_unix_save(c3_m bas_m, c3_c* pax_c, u3_atom pad); + u3_unix_save(c3_c* pax_c, u3_atom pad); /* u3_unix_cane(): true iff (unix) path is canonical. */ diff --git a/pkg/urbit/vere/io/term.c b/pkg/urbit/vere/io/term.c index a4c16daed..f2eff77a4 100644 --- a/pkg/urbit/vere/io/term.c +++ b/pkg/urbit/vere/io/term.c @@ -598,7 +598,7 @@ _term_it_save(u3_noun pax, u3_noun pad) { c3_c* pax_c = _term_it_path(pax); - u3_unix_save(c3__put, pax_c, pad); + u3_unix_save(pax_c, pad); c3_free(pax_c); } diff --git a/pkg/urbit/vere/io/unix.c b/pkg/urbit/vere/io/unix.c index 56f463384..c9b6e04f7 100644 --- a/pkg/urbit/vere/io/unix.c +++ b/pkg/urbit/vere/io/unix.c @@ -264,7 +264,7 @@ _unix_mkdirp(c3_c* pax_c) } } -/* u3_unix_save(): save file under .../.urb/[bas_m] or bail. +/* u3_unix_save(): save file under .../.urb/put or bail. ** ** XX this is quite bad, and doesn't share much in common with ** the rest of unix.c. at minimum it should instead take pax as @@ -273,18 +273,13 @@ _unix_mkdirp(c3_c* pax_c) ** base directory. */ void -u3_unix_save(c3_m bas_m, c3_c* pax_c, u3_atom pad) +u3_unix_save(c3_c* pax_c, u3_atom pad) { c3_i fid_i; c3_w lod_w, len_w, fln_w, rit_w; c3_y* pad_y; c3_c* ful_c; - c3_assert(3 == u3r_met(3, bas_m)); - c3_assert(c3_s3('b','h','k') != bas_m && - c3_s3('c','h','k') != bas_m && - c3_s3('g','e','t') != bas_m && - c3_s3('l','o','g') != bas_m); if ( '/' == *pax_c) { pax_c++; } @@ -293,11 +288,10 @@ u3_unix_save(c3_m bas_m, c3_c* pax_c, u3_atom pad) u3z(pad); u3m_bail(c3__fail); } lod_w = strlen(u3_Host.dir_c); - len_w = lod_w + sizeof("/.urb/xxx/") + strlen(pax_c); + len_w = lod_w + sizeof("/.urb/put/") + strlen(pax_c); ful_c = c3_malloc(len_w); - rit_w = snprintf(ful_c, len_w, "%s/.urb/xxx/%s", u3_Host.dir_c, pax_c); + rit_w = snprintf(ful_c, len_w, "%s/.urb/put/%s", u3_Host.dir_c, pax_c); c3_assert(len_w == rit_w + 1); - u3r_bytes(0, 3, (c3_y*)ful_c + lod_w + sizeof("/.urb/") - 1, bas_m); _unix_mkdirp(ful_c); fid_i = c3_open(ful_c, O_WRONLY | O_CREAT | O_TRUNC, 0666); diff --git a/pkg/urbit/vere/pier.c b/pkg/urbit/vere/pier.c index 2f7fc5b85..0cdf9abdb 100644 --- a/pkg/urbit/vere/pier.c +++ b/pkg/urbit/vere/pier.c @@ -529,7 +529,7 @@ _pier_on_scry_done(void* ptr_v, u3_noun nun) c3_c fil_c[256]; snprintf(fil_c, 256, "%s.%s", pac_c + 1, ext_c); - u3_unix_save(c3__put, fil_c, pad); + u3_unix_save(fil_c, pad); u3l_log("pier: scry result in %s/.urb/put/%s\n", u3_Host.dir_c, fil_c); } }