本文整理汇总了C++中MakePath函数的典型用法代码示例。如果您正苦于以下问题:C++ MakePath函数的具体用法?C++ MakePath怎么用?C++ MakePath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MakePath函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sName
TYPE_File* ToppyFramework::Hdd_Fopen(char *name )
{
CString sName(name);
if ((sName.Find("/")!=-1) || (sName.Find("\\")!=-1))
{
LogError("Tried to open a file with a path in the name - %s", name);
return 0;
}
FILE* handle = fopen(MakePath(name), "rb+"); // open for update
if (handle == NULL)
{
LogError("Failed to open file %s", (LPCSTR) MakePath(name));
return 0;
}
TYPE_File* pToppyHandle = new TYPE_File();
ZeroMemory(pToppyHandle, sizeof(TYPE_File));
strncpy(pToppyHandle->name, name, 100);
m_mapOpenFiles[pToppyHandle] = handle;
pToppyHandle->size = Hdd_Flen(pToppyHandle);
LogInfo("Opened %s - handle 0x%x, TYPE_File 0x%x", (LPCSTR) MakePath(name), handle, pToppyHandle);
pToppyHandle->startCluster = GetStartClusterHash(name);
pToppyHandle->totalCluster = 0;
// TODO: more initialization?
return pToppyHandle;
}
示例2: FullLoad
bool TRoss::FullLoad(const char* _RossPath)
{
if (!LoadOnlyConstants(_RossPath))
return false;
if(!MakePath (RossPath, "Cortege.bin", CortegeFile))
{
m_LastError = "cannot find Cortege.bin";
return false;
};
if(!MakePath (RossPath, "Units.bin", UnitsFile) )
{
m_LastError = "cannot find Units.bin";
return false;
};
BuildUnits ();
if(!BuildCorteges ())
{
m_LastError = "Cannot build corteges";
return false;
}
return true;
}
示例3: Cwd
void Cwd(char *param)
{
char tmp[PATH_MAX];
if (param[0] == '/')
MakePath(tmp, "", param);
else
MakePath(tmp, path, param);
if (chdir(tmp) == -1) {
Error(param);
} else {
if (getcwd(tmp, PATH_MAX) == NULL)
ERRS("Permission denied");
else {
if (anonymous_login) {
if (strncmp(basedir, tmp, strlen(basedir)) != 0) {
chdir(basedir);
strcpy(path, "/");
} else {
strncpy(path, &tmp[strlen(basedir)], PATH_MAX);
strcat(path, "/");
};
} else strcpy(path, tmp);
outs("250 CWD command successful.");
};
};
};
示例4: switch
sBool sDIFile::SetAttr(sInt attr,void *data,sInt s)
{
sChar path[sDI_PATHSIZE];
sChar path2[sDI_PATHSIZE];
sInt result;
result = sTRUE;
switch(attr)
{
case sDIA_NAME:
MakePath(path);
MakePath(path2,(sChar *)data);
result = sSystem->RenameFile(path,path2);
if(result)
sCopyString(Name,(sChar *)data,sizeof(Name));
break;
case sDIA_DATA:
MakePath(path);
result = sSystem->SaveFile(path,(sU8 *)data,s);
if(result)
Size = s;
else
;//Size = 0; // need better error handling here!
break;
default:
result = sFALSE;
break;
}
return result;
}
示例5: GetWindowRect
void CWndSelectAwakeCase::OnInitialUpdate()
{
CWndNeuz::OnInitialUpdate();
// 여기에 코딩하세요
// 윈도를 중앙으로 옮기는 부분.
CRect rectRoot = m_pWndRoot->GetLayoutRect();
CRect rectWindow = GetWindowRect();
CPoint point( rectRoot.right - rectWindow.Width(), 110 );
Move( point );
MoveParentCenter();
ItemProp* pProp = (ItemProp*)prj.GetItemProp( m_dwItemIndex );
if( pProp )
m_pTexture = CWndBase::m_textureMng.AddTexture( g_Neuz.m_pd3dDevice, MakePath( DIR_ITEM, pProp->szIcon ), 0xffff00ff );
m_pTexGuage = CWndBase::m_textureMng.AddTexture( g_Neuz.m_pd3dDevice, MakePath( DIR_THEME, "Wndguage.tga" ), 0xffff00ff );
if( !m_pTexGuage )
Error( "CWndSelectAwakeCase::OnInitialUpdate m_pTexGuage(Wndguage.tga) is NULL" );
AddWndStyle( WBS_MODAL );
RestoreDeviceObjects( );
}
示例6: Initialize
/*
* Initialize the process by reading environment variables and files
*/
static void Initialize(void)
{
char *temp;
ListOfString *fileList;
int stateDirLen;
/*
* Process miscellaneous parameters from the initial environment.
*/
checkpointThreshold =
IntGetEnv(CKP_THRESHOLD_VAR, CKP_THRESHOLD_DEFAULT);
cartHoldSeconds =
IntGetEnv(CART_HOLD_MINUTES_VAR, CART_HOLD_MINUTES_DEFAULT)*60;
/*
* Create an empty in-memory shopping cart data structure.
*/
cartTablePtr = &cartTable;
Tcl_InitHashTable(cartTablePtr, TCL_STRING_KEYS);
/*
* Compute the state directory name from the initial environment
* variables.
*/
stateDir = getenv(STATE_DIR_VAR);
stateDirLen = Strlen(stateDir);
assert(stateDirLen > 0);
if(stateDir[stateDirLen - 1] == '/') {
stateDir[stateDirLen - 1] = '\000';
}
fcgiProcessId = getenv(PID_VAR);
if(fcgiProcessId != NULL) {
stateDir = StringCat4(stateDir, ".", fcgiProcessId, "/");
} else {
stateDir = StringCat(stateDir, "/");
}
/*
* Read the state directory to determine the current
* generation number and a list of files that may
* need to be deleted (perhaps left over from an earlier
* system crash). Recover the current generation
* snapshot and log (either or both may be missing),
* populating the in-memory shopping cart data structure.
* Take a checkpoint, making the current log empty.
*/
AnalyzeStateDir(stateDir, SNP_PREFIX, &generation, &fileList);
snapshotPath = MakePath(stateDir, SNP_PREFIX, generation);
RecoverFile(snapshotPath);
logPath = MakePath(stateDir, LOG_PREFIX, generation);
numLogRecords = RecoverFile(logPath);
Checkpoint();
/*
* Clean up stateDir without removing the current snapshot and log.
*/
while(fileList != NULL) {
char *cur = ListOfString_Head(fileList);
if(strcmp(snapshotPath, cur) && strcmp(logPath, cur)) {
remove(cur);
}
fileList = ListOfString_RemoveElement(fileList, cur);
}
}
示例7: while
WORD ToppyFramework::Hdd_ChangeDir(char *dir )
{
CString sChange = dir;
if (sChange == ".")
return 1;
if (sChange.ReverseFind(L'/') == sChange.GetLength() -1)
{
return 0; // toppy doesn't like stuff ending with /
}
else
{
if (sChange.ReverseFind(L'.') == sChange.GetLength() - 1)
sChange += "/"; // however this routine likes it so we put one on to make the code below simpler
}
while (sChange.Left(3) == "../")
{
if (m_sCurrentFolder == "/")
return 1;
int iTrim = m_sCurrentFolder.ReverseFind('/');
if (iTrim >= 0)
m_sCurrentFolder = m_sCurrentFolder.Left(iTrim);
sChange = sChange.Mid(3);
}
if (sChange.IsEmpty())
return 1;
word result = 1;
CString sNewDir = MakePath(sChange);
if (_access(sNewDir, 00) != 0)
{
result = 0;
while (true)
{
int iTrim = sChange.ReverseFind('/');
sChange = sChange.Left(iTrim);
if (sChange.IsEmpty())
break;
sNewDir = MakePath(sChange);
if (_access(sNewDir, 00) == 0)
break;
}
}
if (!sChange.IsEmpty())
m_sCurrentFolder += "/";
m_sCurrentFolder += sChange;
return result;
}
示例8: GetWindowRect
void CWndPartyCtrl::OnInitialUpdate()
{
CRect rect = GetWindowRect();
m_wndScrollBar.AddWndStyle( WBS_DOCKING );
m_wndScrollBar.Create( WBS_VERT, rect, this, 1000 );//,m_pSprPack,-1);
m_nFontHeight = 20;//GetFontHeight( &g_2DRender );
RestoreDeviceObjects();
m_texGauEmptyNormal.LoadTexture( m_pApp->m_pd3dDevice, MakePath( DIR_THEME, "GauEmptySmall.bmp" ), 0xffff00ff, TRUE );
m_texGauFillNormal.LoadTexture( m_pApp->m_pd3dDevice, MakePath( DIR_THEME, "GauFillSmall.bmp" ), 0xffff00ff, TRUE );
}
示例9: MakeUserRoot
string MakeUserRoot(string &userName)
{
string path = GetEnvVar("USER_ROOT");
if(path.empty())
{
path = USER_ROOT;
}
MakePath(path,userName);
MakePath(path,"/home/wwwroot");
return path;
}
示例10: MakePath
QString
WUploadThread::MakeUploadPath(MessageRef ref)
{
QString filename;
if (GetStringFromMessage(ref, "beshare:File Name", filename) == B_OK)
{
QString path;
if (GetStringFromMessage(ref, "winshare:Path", path) == B_OK)
return MakePath(path, filename);
if (GetStringFromMessage(ref, "beshare:Path", path) == B_OK)
return MakePath(path, filename);
}
return QString::null;
}
示例11: ResetMap
void MysteryDungeonMaker::CreateDungeon()
{
ResetMap();
std::vector<Component> section_components;
const size_t sectionRowNum = dungeonSize->DungeonRowNum();
const size_t sectionColumnNum = dungeonSize->DungeonColumnNum();
for (size_t i = 0; i < sectionRowNum; i++)
{
for (size_t j = 0; j < sectionColumnNum; j++)
{
section_components.push_back(Component(i, j));
this->sections[i][j].SetComponent(i, j);
}
}
std::random_device rd;
shuffle(section_components.begin(), section_components.end(), std::mt19937_64(rd()));
for (int i = 0; i < roomNum; i++)
{
int i_section = section_components[i].i;
int j_section = section_components[i].j;
int width = GetRandInRange(minRoomWidth, sectionColumnNum - 4);
int height = GetRandInRange(minRoomHeight, sectionRowNum - 4);
MakeRoom(Component(i_section, j_section), width, height);
}
MakePath();
}
示例12: GetWndCtrl
BOOL CWndBlessingCancel::OnDropIcon( LPSHORTCUT pShortcut, CPoint point )
{
CItemElem* pTempElem;
pTempElem = (CItemElem*)g_pPlayer->GetItemId( pShortcut->m_dwId );
if( g_xRandomOptionProperty->GetRandomOptionKind( pTempElem ) == CRandomOptionProperty::eBlessing
&& g_xRandomOptionProperty->GetRandomOptionSize( pTempElem->GetRandomOptItemId() ))
{
// 하락 상태가 된 아이템만 올릴 수 있다.
if(pTempElem != NULL)
{
if(m_pItemElem) m_pItemElem->SetExtra(0);
m_pItemElem = pTempElem;
m_pEItemProp = m_pItemElem->GetProp();
m_pItemElem->SetExtra(m_pItemElem->GetExtra()+1);
CWndButton* pButton = (CWndButton*)GetDlgItem(WIDC_START);
pButton->EnableWindow(TRUE);
LPWNDCTRL wndCtrl = GetWndCtrl( WIDC_CHANGE );
if(m_pEItemProp != NULL)
{
m_pTexture = CWndBase::m_textureMng.AddTexture( g_Neuz.m_pd3dDevice, MakePath( DIR_ITEM, m_pEItemProp->szIcon), 0xffff00ff );
}
}
}
else
{
g_WndMng.PutString( prj.GetText(TID_GAME_BLESSEDNESS_CANCEL), NULL, 0xffff0000 );
return FALSE;
}
return TRUE;
}
示例13: PreConnection
void PreConnection(char *param, char open_mode, int data_mode)
{
char tmp[PATH_MAX];
char mode[3];
struct stat s;
MakePath(tmp, path, param);
mode[0] = open_mode;
if (transfer_type == 'i')
mode[1] = 'b';
else
mode[1] = 't';
mode[2] = 0;
if (data_mode && stat(tmp, &s) == -1) {
Error(param);
return;
};
if ((data_file = fopen(tmp, mode)) == NULL) {
Error(param);
return;
};
if (open_mode != 'a')
fseek(data_file, file_rest, SEEK_SET);
if (data_mode) {
sprintf(tmp, "%s (%d bytes)", param, (int)(s.st_size - file_rest));
} else {
strcpy(tmp, param);
};
DataConnection(data_mode, transfer_type, tmp);
};
示例14: LoadMapMonsterInformationPack
//-----------------------------------------------------------------------------
BOOL CMapInformationManager::LoadMapMonsterInformationPack( void )
{
for( MapComboBoxDataVector::iterator Iterator = m_MapNameVector.begin(); Iterator != m_MapNameVector.end(); ++Iterator )
{
CMapComboBoxData* pMapComboBoxData = ( CMapComboBoxData* )( *Iterator );
if( pMapComboBoxData == NULL )
{
continue;
}
if( pMapComboBoxData->GetMapMonsterInformationFileName() == _T( "" ) )
{
continue;
}
CMapMonsterInformationPack* pMapMonsterInformationPack = new CMapMonsterInformationPack;
if( pMapMonsterInformationPack->LoadScript( MakePath( DIR_THEME, pMapComboBoxData->GetMapMonsterInformationFileName() ) ) == FALSE )
{
continue;
}
m_MapMonsterInformationPackMap[ pMapComboBoxData->GetID() ] = pMapMonsterInformationPack;
}
return TRUE;
}
示例15: abs
bool BackupMgr::SaveBackup(SciDoc*sci)
{
FXString savename;
FXString untitled;
untitled.format(FN_FMT, backupdir.text(), abs(getpid()), SciDocUtils::ID(sci));
if (SciDocUtils::Filename(sci).empty()) {
savename=untitled;
} else {
if (FXStat::isFile(untitled)) {
RemoveBackup(untitled);
}
#ifdef WIN32
savename=SciDocUtils::Filename(sci).text();
savename.substitute(':', '%', true);
savename.prepend(backupdir.text());
#else
savename.format("%s%s", backupdir.text(), SciDocUtils::Filename(sci).text());
#endif
}
if (MakePath(FXPath::directory(savename))) {
if (SciDocUtils::SaveToFile(sci,savename.text(),false)) {
SciDocUtils::NeedBackup(sci, false);
return true;
} else {
lasterror=SciDocUtils::GetLastError(sci);
ErrorMessage(_("Failed to save backup"), savename);
return false;
}
} else {
return false;
}
}