MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / mainMv

Function mainMv

src/fe-mv.cc:16–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14static StringFlag newFilename({"--path2"}, "new filename", "");
15
16int mainMv(int argc, const char* argv[])
17{
18 if (argc == 1)
19 showProfiles("mv", formats);
20 flags.parseFlagsWithConfigFiles(argc, argv, formats);
21
22 try
23 {
24 auto filesystem = Filesystem::createFilesystemFromConfig();
25
26 Path oldPath(oldFilename);
27 if (oldPath.size() == 0)
28 error("old filename missing");
29
30 Path newPath(newFilename);
31 if (newPath.size() == 0)
32 error("new filename missing");
33
34 filesystem->moveFile(oldPath, newPath);
35 filesystem->flushChanges();
36 }
37 catch (const FilesystemException& e)
38 {
39 error("{}", e.message);
40 }
41
42 return 0;
43}

Callers

nothing calls this directly

Calls 6

showProfilesFunction · 0.85
errorFunction · 0.85
sizeMethod · 0.45
moveFileMethod · 0.45
flushChangesMethod · 0.45

Tested by

no test coverage detected