本文整理汇总了C++中BlockFile::IsLocked方法的典型用法代码示例。如果您正苦于以下问题:C++ BlockFile::IsLocked方法的具体用法?C++ BlockFile::IsLocked怎么用?C++ BlockFile::IsLocked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BlockFile
的用法示例。
在下文中一共展示了BlockFile::IsLocked方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetProject
bool DirManager::SetProject(wxString & projPath, wxString & projName,
bool create)
{
wxString oldPath = projPath;
wxString oldName = projName;
wxString oldFull = projFull;
wxString oldLoc = projFull;
if (oldLoc == "")
oldLoc = temp;
lastProject = projPath;
if (projPath == "")
projPath =::wxGetCwd();
this->projPath = projPath;
this->projName = projName;
this->projFull = projPath + wxFILE_SEP_PATH + projName;
if (create) {
if (!wxPathExists(projFull))
if (!wxMkdir(projFull))
return false;
#ifdef __UNIX__
chmod(projFull, 0775);
#endif
} else {
#ifndef __WXMAC__
if (!wxPathExists(projFull))
return false;
#endif
}
/* Move all files into this new directory. Files which are
"locked" get copied instead of moved. (This happens when
we perform a Save As - the files which belonged to the last
saved version of the old project must not be moved,
otherwise the old project would not be safe. */
blockFileHash->BeginFind();
wxNode *n = blockFileHash->Next();
bool success = true;
while(n && success) {
BlockFile *b = (BlockFile *)n->GetData();
if (b->IsLocked())
success = CopyToNewProjectDirectory(b);
else
success = MoveToNewProjectDirectory(b);
n = blockFileHash->Next();
}
if (!success) {
// If the move failed, we try to move/copy as many files
// back as possible so that no damage was done. (No sense
// in checking for errors this time around - there's nothing
// that could be done about it.)
// Likely causes: directory was not writeable, disk was full
projFull = oldLoc;
blockFileHash->BeginFind();
wxNode *n = blockFileHash->Next();
while(n) {
BlockFile *b = (BlockFile *)n->GetData();
MoveToNewProjectDirectory(b);
n = blockFileHash->Next();
}
projFull = oldFull;
projPath = oldPath;
projName = oldName;
return false;
}
return true;
}
示例2: SetProject
bool DirManager::SetProject(wxString & projPath, wxString & projName,
bool create)
{
wxString oldPath = this->projPath;
wxString oldName = this->projName;
wxString oldFull = projFull;
wxString oldLoc = projFull;
if (oldLoc == wxT(""))
oldLoc = mytemp;
if (projPath == wxT(""))
projPath = ::wxGetCwd();
this->projPath = projPath;
this->projName = projName;
this->projFull = projPath + wxFILE_SEP_PATH + projName;
wxString cleanupLoc1=oldLoc;
wxString cleanupLoc2=projFull;
if (create) {
if (!wxDirExists(projFull))
if (!wxMkdir(projFull))
return false;
#ifdef __UNIX__
chmod(OSFILENAME(projFull), 0775);
#endif
} else {
#ifndef __WXMAC__
if (!wxDirExists(projFull))
return false;
#endif
}
/* Move all files into this new directory. Files which are
"locked" get copied instead of moved. (This happens when
we perform a Save As - the files which belonged to the last
saved version of the old project must not be moved,
otherwise the old project would not be safe. */
AudacityProject *p = GetActiveProject();
if (p)
p->ProgressShow(_("Progress"),
_("Saving project data files"));
int total=blockFileHash.size();
int count=0;
BlockHash::iterator i=blockFileHash.begin();
bool success = true;
while(i != blockFileHash.end() && success) {
BlockFile *b = i->second;
if (b->IsLocked())
success = CopyToNewProjectDirectory(b);
else{
success = MoveToNewProjectDirectory(b);
}
if (p)
p->ProgressUpdate(int ((count * 1000.0) / total));
i++;
count++;
}
if (!success) {
// If the move failed, we try to move/copy as many files
// back as possible so that no damage was done. (No sense
// in checking for errors this time around - there's nothing
// that could be done about it.)
// Likely causes: directory was not writeable, disk was full
projFull = oldLoc;
BlockHash::iterator i=blockFileHash.begin();
while(i != blockFileHash.end()) {
BlockFile *b = i->second;
MoveToNewProjectDirectory(b);
if (count>=0 && p)
p->ProgressUpdate(int ((count * 1000.0) / total));
i++;
count--;
}
this->projFull = oldFull;
this->projPath = oldPath;
this->projName = oldName;
if (p)
p->ProgressHide();
return false;
}
if (p)
//.........这里部分代码省略.........