MCPcopy Create free account
hub / github.com/DavidColson/Polybox / VfsCopy

Function VfsCopy

source/virtual_filesystem.cpp:122–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120// ***********************************************************************
121
122int VfsCopy(lua_State* L) {
123 u64 fromLen;
124 const char* from = luaL_checklstring(L, 1, &fromLen);
125 String realFrom;
126 if (!VFSPathToRealPath(String(from), realFrom, g_pArenaFrame)) {
127 luaL_error(L, "Filepath not in a valid mount point", from);
128 lua_pushboolean(L, false);
129 return 1;
130 }
131
132 u64 toLen;
133 const char* to = luaL_checklstring(L, 2, &toLen);
134 String realTo;
135 if (!VFSPathToRealPath(String(to), realTo, g_pArenaFrame)) {
136 luaL_error(L, "Filepath not in a valid mount point", to);
137 lua_pushboolean(L, false);
138 return 1;
139 }
140
141
142 bool result = CopyFile(realFrom, realTo);
143 lua_pushboolean(L, result);
144 return 1;
145}
146
147// ***********************************************************************
148

Callers

nothing calls this directly

Calls 2

VFSPathToRealPathFunction · 0.85
StringClass · 0.70

Tested by

no test coverage detected