Hello, anyone can help me to figure out the problem with creating the files using sm function, i dont know why it dont want create files in CS:GO and also create directories with wrong permissions on Linux
I am getting correct path
addons/sourcemod/addons/sourcemod/zombieplague/precache/materials/zombie_bomb.txt
PHP Code:
// Gets precache folder path
static char sPath[PLATFORM_MAX_PATH];
bool bExists = ConfigGetCvarFolderPath(CVAR_CONFIG_PATH_PRECACHE, sPath, "materials", sModel);
// Open the file
PrintToServer(sPath);
///BuildPath(Path_SM, sPath, PLATFORM_MAX_PATH, sPath); I also tryed to use that before openFile
File hBase = OpenFile(sPath, "at+");
hBase always INVALID_HANDLE, i tryed all modes, a, a+, at+, w, and no changes
PHP Code:
stock bool ConfigGetCvarFolderPath(const CvarsList iConVar, char[] sPath, const char[] sFolder, const char[] sFile)
{
// Gets cvar path
static char sFolderPath[PLATFORM_MAX_PATH];
gCvarList[iConVar].GetString(sFolderPath, sizeof(sFolderPath));
// Build full path in return string
BuildPath(Path_SM, sPath, PLATFORM_MAX_PATH, sFolderPath);
// If folder doesn't exist, then create it
if(!DirExists(sPath))
{
// Create it
CreateDirectory(sPath, 741);
}
// Build full path in return string
BuildPath(Path_SM, sPath, PLATFORM_MAX_PATH, "%s/%s", sFolderPath, sFolder);
// If folder doesn't exist, then create it
if(!DirExists(sPath))
{
// Create it
CreateDirectory(sPath, 741);
}
// Finds the first occurrence of a character in a string
int iFile = FindCharInString(sFile, '/', true);
if(iFile == -1) iFile = FindCharInString(sFile, '\\', true); /// Bugfix for windows separator
// Validate no file
if(iFile == -1)
{
return false;
}
// Finds the first occurrence of a character in a string
int iFormat = FindCharInString(sFile, '.', true);
// Validate no format
if(iFormat == -1)
{
return false;
}
// Extract file name
static char sName[PLATFORM_MAX_PATH];
StrExtract(sName, sFile, iFile, iFormat);
// Format full path to file
BuildPath(Path_SM, sPath, PLATFORM_MAX_PATH, "%s%s.txt", sPath, sName);
// If file is exist, then return true
return FileExists(sPath);
}
Is it possible to create txt files in folder of models/materials for example instead ????????
__________________