コード例 #1
0
ファイル: fileio.c プロジェクト: hilander/demoscene
static PtrT ReadFileToCustomMemory(const StrT fileName, uint32_t memFlags) {
    BPTR fh;
    PtrT data = NULL;
    PtrT path = AbsPath(fileName);

    if ((fh = Open(path, MODE_OLDFILE))) {
        struct FileInfoBlock *infoBlock;

        if ((infoBlock = (struct FileInfoBlock *) AllocDosObject(DOS_FIB, NULL))) {
            if (ExamineFH(fh, infoBlock)) {
                size_t dataLen = infoBlock->fib_Size;

                if ((data = MemNewCustom(dataLen, memFlags, NULL))) {
                    if (dataLen != Read(fh, data, dataLen)) {
                        MemUnref(data);
                        data = NULL;
                    }
                }
            }
            FreeDosObject(DOS_FIB, infoBlock);
        }
        Close(fh);
    }

    MemUnref(path);

    return data;
}
コード例 #2
0
void CChordEaseApp::MakeAbsolutePath(CString& Path)
{
	if (PathIsRelative(Path)) {	// if path is relative
		CPathStr	AbsPath(GetDataFolderPath());
		AbsPath.Append(Path);
		Path = AbsPath;
	}
}
コード例 #3
0
ファイル: fileio.c プロジェクト: hilander/demoscene
void WriteFileSimple(const StrT fileName, PtrT data, size_t length) {
    BPTR fh;
    PtrT path = AbsPath(fileName);

    if ((fh = Open(path, MODE_NEWFILE))) {
        Write(fh, data, length);
        Close(fh);
    }
}
コード例 #4
0
void CChordEaseApp::ValidateFolder(CDataExchange* pDX, int CtrlID, const CString& Path)
{
	if (pDX->m_bSaveAndValidate) {
		CString	msg;
		if (Path.IsEmpty())	// if path is empty
			msg.LoadString(IDS_APP_FOLDER_REQUIRED);
		else {
			CString	AbsPath(Path);
			theApp.MakeAbsolutePath(AbsPath);
			if (!PathFileExists(AbsPath))	// if path doesn't exist
				AfxFormatString1(msg, IDS_APP_FOLDER_NOT_FOUND, AbsPath);
		}
		if (!msg.IsEmpty()) {
			AfxMessageBox(msg);
			DDV_Fail(pDX, CtrlID);
		}
	}
}
コード例 #5
0
ファイル: ConfigManager.hpp プロジェクト: brho/xword
 bool HasEntry(const wxString & path) const
     { return m_items.find(AbsPath(path)) != m_items.end(); }
コード例 #6
0
ファイル: ConfigManager.hpp プロジェクト: brho/xword
 void SetPath(const wxString & path) { m_path = AbsPath(path); }