Ejemplo n.º 1
0
static uint FOG_CDECL FileUtil_createDirectoryHelper(const CharW* path, size_t len)
{
  if (len == 3 && path[0].isAsciiLetter() && path[1] == CharW(':') && path[2] == CharW('/'))
  {
    // TODO: Maybe we should return failure if disk is not mounted.
    return ERR_PATH_EXISTS;
  }

  StringTmpW<TEMPORARY_LENGTH> pathW(StubW(path, len));
  FOG_RETURN_ON_ERROR(WinUtil::makeWinPath(pathW, pathW));

  if (!CreateDirectoryW(reinterpret_cast<const wchar_t*>(pathW.getData()), NULL))
    return OSUtil::getErrFromOSLastError();

  return ERR_OK;
}
Ejemplo n.º 2
0
DWORD WINAPI execute_python_script(LPVOID param)
{
    wchar_t *path = (wchar_t*)param;
    Addtolist(0, WHITE, NAME_PLUGIN L" Trying to execute the script located here: '%s'..", path);

    std::wstring pathW(path);
    std::string pathA(widechar_to_multibytes(pathW));

    PyObject* PyFileObject = PyFile_FromString((char*)pathA.c_str(), "r");
    if(PyFileObject == NULL)
    {
        Addtolist(0, RED, NAME_PLUGIN L" Your file doesn't exist.");
        goto clean;
    }

    PyRun_SimpleFile(PyFile_AsFile(PyFileObject), (char*)pathA.c_str());

    Addtolist(0, WHITE, NAME_PLUGIN L" Execution is done!");

clean:
    free(path);
    return 1;
}