mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 02:27:40 -04:00
Deprecate plFileUtils and parts of pnUtPath
This commit is contained in:
@ -208,7 +208,7 @@ PyObject* cyMisc::FindSceneObject(const plString& name, const char* ageName)
|
||||
const char* theAge = ageName;
|
||||
if ( ageName[0] == 0 )
|
||||
theAge = nil;
|
||||
key=plKeyFinder::Instance().StupidSearch(theAge,nil,plSceneObject::Index(), name, false);
|
||||
key=plKeyFinder::Instance().StupidSearch(theAge, "", plSceneObject::Index(), name, false);
|
||||
}
|
||||
|
||||
if ( key == nil )
|
||||
@ -1457,7 +1457,7 @@ void cyMisc::PageOutNode(const char* nodeName)
|
||||
plClientMsg* pMsg1 = new plClientMsg(plClientMsg::kUnloadRoom);
|
||||
plKey clientKey = hsgResMgr::ResMgr()->FindKey( kClient_KEY );
|
||||
pMsg1->AddReceiver( clientKey );
|
||||
pMsg1->AddRoomLoc(plKeyFinder::Instance().FindLocation(nil, nodeName));
|
||||
pMsg1->AddRoomLoc(plKeyFinder::Instance().FindLocation("", nodeName));
|
||||
plgDispatch::MsgSend(pMsg1);
|
||||
}
|
||||
}
|
||||
@ -2484,7 +2484,7 @@ void cyMisc::RebuildCameraStack(const plString& name, const char* ageName)
|
||||
|
||||
if ( !name.IsEmpty() )
|
||||
{
|
||||
key=plKeyFinder::Instance().StupidSearch(nil,nil,plSceneObject::Index(), name, false);
|
||||
key=plKeyFinder::Instance().StupidSearch("", "", plSceneObject::Index(), name, false);
|
||||
}
|
||||
if ( key == nil )
|
||||
{
|
||||
@ -2685,7 +2685,7 @@ void cyMisc::FakeLinkToObjectNamed(const plString& name)
|
||||
plKey key = nil;
|
||||
if ( !name.IsEmpty() )
|
||||
{
|
||||
key = plKeyFinder::Instance().StupidSearch(nil,nil,plSceneObject::Index(), name, false);
|
||||
key = plKeyFinder::Instance().StupidSearch("", "", plSceneObject::Index(), name, false);
|
||||
}
|
||||
|
||||
if (!key)
|
||||
@ -2790,28 +2790,24 @@ bool cyMisc::DumpLogs(const std::wstring & folder)
|
||||
return retVal;
|
||||
}
|
||||
|
||||
bool cyMisc::FileExists(const std::wstring & filename)
|
||||
bool cyMisc::FileExists(const plFileName & filename)
|
||||
{
|
||||
return PathDoesFileExist(filename.c_str());
|
||||
return plFileInfo(filename).Exists();
|
||||
}
|
||||
|
||||
bool cyMisc::CreateDir(const std::wstring & directory)
|
||||
bool cyMisc::CreateDir(const plFileName & directory)
|
||||
{
|
||||
return PathCreateDirectory(directory.c_str(), kPathCreateDirFlagEntireTree) == kPathCreateDirSuccess;
|
||||
return plFileSystem::CreateDir(directory, true);
|
||||
}
|
||||
|
||||
std::wstring cyMisc::GetUserPath()
|
||||
plFileName cyMisc::GetUserPath()
|
||||
{
|
||||
wchar_t path[MAX_PATH];
|
||||
PathGetUserDirectory(path, arrsize(path));
|
||||
return path;
|
||||
return plFileSystem::GetUserDataPath();
|
||||
}
|
||||
|
||||
std::wstring cyMisc::GetInitPath()
|
||||
plFileName cyMisc::GetInitPath()
|
||||
{
|
||||
wchar_t path[MAX_PATH];
|
||||
PathGetInitDirectory(path, arrsize(path));
|
||||
return path;
|
||||
return plFileSystem::GetInitPath();
|
||||
}
|
||||
|
||||
void cyMisc::SetBehaviorNetFlags(pyKey & behKey, bool netForce, bool netProp)
|
||||
|
@ -42,8 +42,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#ifndef cyMisc_h
|
||||
#define cyMisc_h
|
||||
|
||||
#include <string>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// NAME: cyMisc
|
||||
@ -67,6 +65,7 @@ class pyGUIDialog;
|
||||
class plPipeline;
|
||||
class plDisplayMode;
|
||||
class plUUID;
|
||||
class plFileName;
|
||||
struct PipelineParams;
|
||||
|
||||
typedef struct _object PyObject;
|
||||
@ -934,11 +933,11 @@ public:
|
||||
|
||||
static bool DumpLogs(const std::wstring & folder);
|
||||
|
||||
static bool FileExists(const std::wstring & filename);
|
||||
static bool CreateDir(const std::wstring & directory);
|
||||
static bool FileExists(const plFileName & filename);
|
||||
static bool CreateDir(const plFileName & directory);
|
||||
|
||||
static std::wstring GetUserPath();
|
||||
static std::wstring GetInitPath();
|
||||
static plFileName GetUserPath();
|
||||
static plFileName GetInitPath();
|
||||
|
||||
static void SetBehaviorNetFlags(pyKey & behKey, bool netForce, bool netProp);
|
||||
static void SendFriendInvite(const wchar_t email[], const wchar_t toName[]);
|
||||
|
@ -632,24 +632,9 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtFileExists, args, "Params: filename\nReturns t
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
if (PyUnicode_Check(filenameObj))
|
||||
if (PyString_CheckEx(filenameObj))
|
||||
{
|
||||
int strLen = PyUnicode_GetSize(filenameObj);
|
||||
wchar_t* text = new wchar_t[strLen + 1];
|
||||
PyUnicode_AsWideChar((PyUnicodeObject*)filenameObj, text, strLen);
|
||||
text[strLen] = L'\0';
|
||||
bool retVal = cyMisc::FileExists(text);
|
||||
delete [] text;
|
||||
PYTHON_RETURN_BOOL(retVal);
|
||||
}
|
||||
else if (PyString_Check(filenameObj))
|
||||
{
|
||||
// we'll allow this, just in case something goes weird
|
||||
char* text = PyString_AsString(filenameObj);
|
||||
wchar_t* wText = hsStringToWString(text);
|
||||
bool retVal = cyMisc::FileExists(wText);
|
||||
delete [] wText;
|
||||
PYTHON_RETURN_BOOL(retVal);
|
||||
PYTHON_RETURN_BOOL(cyMisc::FileExists(PyString_AsStringEx(filenameObj)));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -667,24 +652,9 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtCreateDir, args, "Params: directory\nCreates t
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
if (PyUnicode_Check(directoryObj))
|
||||
if (PyString_CheckEx(directoryObj))
|
||||
{
|
||||
int strLen = PyUnicode_GetSize(directoryObj);
|
||||
wchar_t* text = new wchar_t[strLen + 1];
|
||||
PyUnicode_AsWideChar((PyUnicodeObject*)directoryObj, text, strLen);
|
||||
text[strLen] = L'\0';
|
||||
bool retVal = cyMisc::CreateDir(text);
|
||||
delete [] text;
|
||||
PYTHON_RETURN_BOOL(retVal);
|
||||
}
|
||||
else if (PyString_Check(directoryObj))
|
||||
{
|
||||
// we'll allow this, just in case something goes weird
|
||||
char* text = PyString_AsString(directoryObj);
|
||||
wchar_t* wText = hsStringToWString(text);
|
||||
bool retVal = cyMisc::CreateDir(wText);
|
||||
delete [] wText;
|
||||
PYTHON_RETURN_BOOL(retVal);
|
||||
PYTHON_RETURN_BOOL(cyMisc::CreateDir(PyString_AsStringEx(directoryObj)));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -695,14 +665,12 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtCreateDir, args, "Params: directory\nCreates t
|
||||
|
||||
PYTHON_GLOBAL_METHOD_DEFINITION_NOARGS(PtGetUserPath, "Returns the unicode path to the client's root user directory. Do NOT convert to a standard string.")
|
||||
{
|
||||
std::wstring val = cyMisc::GetUserPath();
|
||||
return PyUnicode_FromWideChar(val.c_str(), val.length());
|
||||
return PyUnicode_FromStringEx(cyMisc::GetUserPath().AsString());
|
||||
}
|
||||
|
||||
PYTHON_GLOBAL_METHOD_DEFINITION_NOARGS(PtGetInitPath, "Returns the unicode path to the client's init directory. Do NOT convert to a standard string.")
|
||||
{
|
||||
std::wstring val = cyMisc::GetInitPath();
|
||||
return PyUnicode_FromWideChar(val.c_str(), val.length());
|
||||
return PyUnicode_FromStringEx(cyMisc::GetInitPath().AsString());
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
@ -438,12 +438,8 @@ bool plPythonFileMod::ILoadPythonCode()
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||
// get code from file and execute in module
|
||||
// see if the file exists first before trying to import it
|
||||
char pathandfile[256];
|
||||
sprintf(pathandfile, ".\\python\\%s.py",fPythonFile);
|
||||
wchar_t *wPathandfile = hsStringToWString(pathandfile);
|
||||
bool exists = PathDoesFileExist(wPathandfile);
|
||||
delete [] wPathandfile;
|
||||
if (exists)
|
||||
plFileName pyfile = plFileName::Join(".", "python", plString::Format("%s.py", fPythonFile));
|
||||
if (plFileInfo(pyfile).Exists())
|
||||
{
|
||||
char fromLoad[256];
|
||||
//sprintf(fromLoad,"from %s import *", fPythonFile);
|
||||
@ -453,7 +449,7 @@ bool plPythonFileMod::ILoadPythonCode()
|
||||
if ( PythonInterface::RunString( fromLoad, fModule) )
|
||||
{
|
||||
// we've loaded the code into our module
|
||||
// now attach the glue python code to the end
|
||||
// now attach the glue python code to the end
|
||||
if ( !PythonInterface::RunString("execfile('.\\\\python\\\\plasma\\\\glue.py')", fModule) )
|
||||
{
|
||||
// display any output (NOTE: this would be disabled in production)
|
||||
|
Reference in New Issue
Block a user