summaryrefslogtreecommitdiffstatshomepage
path: root/src/tools/floptool.cpp
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2021-12-31 13:27:44 -0500
committer AJR <ajrhacker@users.noreply.github.com>2021-12-31 13:28:25 -0500
commitf6f77bf6398cd6b06ce6778fafc772ed42261a3e (patch)
treec4da0575a94f49f3399d4754cac951d26837f573 /src/tools/floptool.cpp
parent54899379258a7266db8d5bc6cda8b48169e67503 (diff)
Move filesystem library into separate namespace and use shorter uX type names there
Diffstat (limited to 'src/tools/floptool.cpp')
-rw-r--r--src/tools/floptool.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/tools/floptool.cpp b/src/tools/floptool.cpp
index 7be0560bae9..b69c3fe1881 100644
--- a/src/tools/floptool.cpp
+++ b/src/tools/floptool.cpp
@@ -243,7 +243,7 @@ static int flopcreate(int argc, char *argv[])
return 1;
}
- fs_meta_data meta;
+ fs::meta_data meta;
image_handler ih;
ih.set_on_disk_path(argv[4]);
@@ -251,7 +251,7 @@ static int flopcreate(int argc, char *argv[])
return ih.floppy_save(dest_format);
}
-static void dir_scan(u32 depth, filesystem_t::dir_t dir, std::vector<std::vector<std::string>> &entries, const std::unordered_map<fs_meta_name, size_t> &nmap, size_t nc, const std::vector<fs_meta_description> &dmetad, const std::vector<fs_meta_description> &fmetad)
+static void dir_scan(u32 depth, fs::filesystem_t::dir_t dir, std::vector<std::vector<std::string>> &entries, const std::unordered_map<fs::meta_name, size_t> &nmap, size_t nc, const std::vector<fs::meta_description> &dmetad, const std::vector<fs::meta_description> &fmetad)
{
std::string head;
for(u32 i = 0; i != depth; i++)
@@ -262,14 +262,14 @@ static void dir_scan(u32 depth, filesystem_t::dir_t dir, std::vector<std::vector
entries.resize(id+1);
entries[id].resize(nc);
switch(c.m_type) {
- case fs_dir_entry_type::dir: {
+ case fs::dir_entry_type::dir: {
auto subdir = dir.dir_get(c.m_key);
auto meta = subdir.metadata();
for(const auto &m : dmetad) {
if(!meta.has(m.m_name))
continue;
size_t slot = nmap.find(m.m_name)->second;
- std::string val = fs_meta::to_string(m.m_type, meta.get(m.m_name));
+ std::string val = fs::meta_value::to_string(m.m_type, meta.get(m.m_name));
if(slot == 0)
val = head + "dir " + val;
entries[id][slot] = val;
@@ -277,17 +277,17 @@ static void dir_scan(u32 depth, filesystem_t::dir_t dir, std::vector<std::vector
dir_scan(depth+1, subdir, entries, nmap, nc, dmetad, fmetad);
break;
}
- case fs_dir_entry_type::file:
- case fs_dir_entry_type::system_file: {
+ case fs::dir_entry_type::file:
+ case fs::dir_entry_type::system_file: {
auto file = dir.file_get(c.m_key);
auto meta = file.metadata();
for(const auto &m : fmetad) {
if(!meta.has(m.m_name))
continue;
size_t slot = nmap.find(m.m_name)->second;
- std::string val = fs_meta::to_string(m.m_type, meta.get(m.m_name));
+ std::string val = fs::meta_value::to_string(m.m_type, meta.get(m.m_name));
if(slot == 0)
- val = head + (c.m_type == fs_dir_entry_type::system_file ? "sys " : "file ") + val;
+ val = head + (c.m_type == fs::dir_entry_type::system_file ? "sys " : "file ") + val;
entries[id][slot] = val;
}
break;
@@ -307,20 +307,20 @@ static int generic_dir(image_handler &ih)
if(!vmeta.empty()) {
std::string vinf = "Volume:";
for(const auto &e : vmetad)
- vinf += util::string_format(" %s=%s", fs_meta_data::entry_name(e.m_name), fs_meta::to_string(e.m_type, vmeta.get(e.m_name)));
+ vinf += util::string_format(" %s=%s", fs::meta_data::entry_name(e.m_name), fs::meta_value::to_string(e.m_type, vmeta.get(e.m_name)));
printf("%s\n\n", vinf.c_str());
}
- std::vector<fs_meta_name> names;
- names.push_back(fs_meta_name::name);
+ std::vector<fs::meta_name> names;
+ names.push_back(fs::meta_name::name);
for(const auto &e : fmetad)
- if(e.m_name != fs_meta_name::name)
+ if(e.m_name != fs::meta_name::name)
names.push_back(e.m_name);
for(const auto &e : dmetad)
if(std::find(names.begin(), names.end(), e.m_name) == names.end())
names.push_back(e.m_name);
- std::unordered_map<fs_meta_name, size_t> nmap;
+ std::unordered_map<fs::meta_name, size_t> nmap;
for(size_t i = 0; i != names.size(); i++)
nmap[names[i]] = i;
@@ -328,8 +328,8 @@ static int generic_dir(image_handler &ih)
std::vector<std::vector<std::string>> entries;
entries.resize(1);
- for(fs_meta_name n : names)
- entries[0].push_back(fs_meta_data::entry_name(n));
+ for(fs::meta_name n : names)
+ entries[0].push_back(fs::meta_data::entry_name(n));
dir_scan(0, root, entries, nmap, names.size(), dmetad, fmetad);
@@ -440,7 +440,7 @@ static int generic_read(image_handler &ih, const char *srcpath, const char *dstp
fprintf(stderr, "Error: directory %s%c%s not found\n", apath.c_str(), fsm->directory_separator(), path[i].c_str());
return 1;
}
- if(c[j].m_type != fs_dir_entry_type::dir) {
+ if(c[j].m_type != fs::dir_entry_type::dir) {
fprintf(stderr, "Error: %s%c%s is not a directory\n", apath.c_str(), fsm->directory_separator(), path[i].c_str());
return 1;
}
@@ -460,14 +460,14 @@ static int generic_read(image_handler &ih, const char *srcpath, const char *dstp
auto file = dir.file_get(c[j].m_key);
auto meta = file.metadata();
- if(!meta.has(fs_meta_name::length)) {
+ if(!meta.has(fs::meta_name::length)) {
fprintf(stderr, "Error: %s%c%s is not a readable file\n", apath.c_str(), fsm->directory_separator(), path.back().c_str());
return 1;
}
image_handler::fsave(dstpath, file.read_all());
- bool has_rsrc = fsm->has_rsrc() && meta.has(fs_meta_name::rsrc_length);
+ bool has_rsrc = fsm->has_rsrc() && meta.has(fs::meta_name::rsrc_length);
if(has_rsrc)
image_handler::fsave_rsrc(image_handler::path_make_rsrc(dstpath), file.rsrc_read_all());
@@ -565,7 +565,7 @@ static int generic_write(image_handler &ih, const char *srcpath, const char *dst
fprintf(stderr, "Error: directory %s%c%s not found\n", apath.c_str(), fsm->directory_separator(), path[i].c_str());
return 1;
}
- if(c[j].m_type != fs_dir_entry_type::dir) {
+ if(c[j].m_type != fs::dir_entry_type::dir) {
fprintf(stderr, "Error: %s%c%s is not a directory\n", apath.c_str(), fsm->directory_separator(), path[i].c_str());
return 1;
}
@@ -574,8 +574,8 @@ static int generic_write(image_handler &ih, const char *srcpath, const char *dst
}
- fs_meta_data meta;
- meta.set(fs_meta_name::name, path.back());
+ fs::meta_data meta;
+ meta.set(fs::meta_name::name, path.back());
auto file = dir.file_create(meta);
auto filedata = image_handler::fload(srcpath);