MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / _initialize

Method _initialize

ogsr_engine/xrCore/LocatorAPI.cpp:596–737  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

594}
595
596void CLocatorAPI::_initialize(u32 flags, LPCSTR fs_name)
597{
598 if (m_Flags.is(flReady))
599 return;
600 CTimer t;
601 t.Start();
602 Log("Initializing File System...");
603 u32 M1 = Memory.mem_usage();
604
605 m_Flags.set(flags, TRUE);
606
607 // scan root directory
608 string4096 buf{};
609 IReader* pFSltx{};
610 // append working folder
611 LPCSTR fs_ltx{};
612
613 // append application path
614 append_path(fsgame::app_root, Core.ApplicationPath, nullptr, FALSE);
615
616 {
617 // find nearest fs.ltx and set fs_root correctly
618 fs_ltx = (fs_name && fs_name[0]) ? fs_name : FSLTX;
619 pFSltx = r_open(fs_ltx);
620
621 if (!pFSltx)
622 pFSltx = r_open(fsgame::app_root, fs_ltx);
623
624 // находим где ж лежит fsgame.ltx
625
626 if (!pFSltx)
627 {
628 if (strstr(Core.Params, "-use-work-dir"))
629 {
630 string_path currentDir;
631 GetCurrentDirectory(std::size(currentDir) - 1, currentDir);
632 currentDir[std::size(currentDir) - 1] = '\0';
633 append_path(fsgame::fs_root, currentDir, nullptr, FALSE);
634 }
635 else
636 {
637 string_path tmpAppPath{};
638 strcpy_s(tmpAppPath, Core.ApplicationPath);
639 if (xr_strlen(tmpAppPath))
640 {
641 tmpAppPath[xr_strlen(tmpAppPath) - 1] = 0;
642 if (strrchr(tmpAppPath, '\\'))
643 *(strrchr(tmpAppPath, '\\') + 1) = 0;
644
645 append_path(fsgame::fs_root, tmpAppPath, nullptr, FALSE);
646 }
647 else
648 append_path(fsgame::fs_root, "", nullptr, FALSE);
649 }
650
651 pFSltx = r_open(fsgame::fs_root, fs_ltx);
652 }
653 else

Callers

nothing calls this directly

Calls 15

LogFunction · 0.85
r_openFunction · 0.85
MsgFunction · 0.85
make_stringFunction · 0.85
_GetItemFunction · 0.85
_GetItemCountFunction · 0.85
IsBOOLFunction · 0.85
xr_strdupFunction · 0.85
CreateLogFunction · 0.85
isMethod · 0.80
eofMethod · 0.80
emplaceMethod · 0.80

Tested by

no test coverage detected