Decompile fn_18339 (LuaChangeDirectoryOfDatas)
Batch #1623 by eAthena: 0 byte-identical, 1 confirmed by peer review. - fn_18339 LuaChangeDirectoryOfDatas: logic confirmed by peer review Reviewed-by: ragnarok-clanker Adds to the build: Source/Script/LuaFileOperations.cpp
This commit is contained in:
parent
6ebe295226
commit
ef5ff48035
3 changed files with 37 additions and 0 deletions
28
Source/Script/LuaFileOperations.cpp
Normal file
28
Source/Script/LuaFileOperations.cpp
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#include "Script/LuaFileOperations.h"
|
||||
#include "File/FileCreation.h"
|
||||
|
||||
extern "C" {
|
||||
#include <lauxlib.h>
|
||||
}
|
||||
|
||||
#include <cstdio>
|
||||
#include <io.h>
|
||||
#include <string>
|
||||
|
||||
// OFFSET: 0x00AFE7D0
|
||||
// FUNCTION: fn_18339
|
||||
int LuaChangeDirectoryOfDatas(lua_State* state) {
|
||||
std::string name = luaL_checkstring(state, 1);
|
||||
std::string sourceDirectory = luaL_checkstring(state, 2);
|
||||
std::string targetDirectory = luaL_checkstring(state, 3);
|
||||
std::string source = sourceDirectory + "\\" + name;
|
||||
std::string target = targetDirectory + "\\" + name;
|
||||
|
||||
if (_access(target.c_str(), 0) != 0 && _access(source.c_str(), 0) == 0) {
|
||||
if (_access(target.c_str(), 0) == 0 || CreateDirectoryPath(targetDirectory)) {
|
||||
std::rename(source.c_str(), target.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue