本文整理汇总了C++中BEntry::IsSymLink方法的典型用法代码示例。如果您正苦于以下问题:C++ BEntry::IsSymLink方法的具体用法?C++ BEntry::IsSymLink怎么用?C++ BEntry::IsSymLink使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BEntry
的用法示例。
在下文中一共展示了BEntry::IsSymLink方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetPath
void InfoStrView::SetPath (const char *path)
{
/* Store the given directory path in "itemPath". If the path is that of a file, it normalizes the path
and gets its parent folder path and stores it in "itemPath"
TODO: Accept a bool parameter "isFolder" to overcome the problem specified in the "else" part */
DeAllocPath();
BEntry entry (path, false); /* Question: Must we traverse the link here ?? */
if (entry.Exists() == true)
{
if (entry.IsFile() || entry.IsSymLink())
{
BEntry parentDir;
entry.GetParent (&parentDir);
BPath dirPath;
parentDir.GetPath (&dirPath);
AllocPath (dirPath.Path());
}
else /* Means it's a directory */
{
AllocPath (path);
}
}
else /* Problem: Assume its a file NOT a directory */
{
BPath parentPath;
BPath dirPath (path);
dirPath.GetParent (&parentPath);
AllocPath (parentPath.Path());
}
}
示例2: RefsReceived
void PecoApp::RefsReceived ( BMessage* msg ) {
entry_ref ref;
BPath aPath;
BEntry aEntry;
off_t size;
time_t timer;
fWindow->Lock();
BTextControl* pfadView = (BTextControl *)fWindow->FindView("pfadView");
fWindow->Unlock();
//Pfad finden
for ( int i=0; msg->FindRef("refs", i, &ref) == B_OK; i++ ) if ( ref.device > 1 ) break;
if ( ref.device > 1 ) {
New();
fWindow->Lock();
((PecoApp *)be_app)->fStatusBar->SetText(STATUS_IMPORT);
fWindow->Unlock();
aEntry = BEntry(&ref);
BPath( &aEntry ).GetParent(&fPfad);
fWindow->Lock();
pfadView->SetText( fPfad.Path() );
fWindow->Unlock();
//zählen
type_code typeFound;
long total = 0;
msg->GetInfo("refs", &typeFound, &total);
fWindow->Lock();
fStatusBar->SetMaxValue( total );
fWindow->Unlock();
BPath newPath;
bool didntshow_msgmultidir = true;
for ( int i=0; msg->FindRef("refs", i, &ref) == B_OK; i++ ) {
fWindow->Lock();
fStatusBar->Update(1);
fWindow->Unlock();
// Laufwerke ausfiltern
if ( ref.device == 1 ) continue;
// Dateien mit falschem Pfad ausfiltern
aEntry = BEntry(&ref);
aPath = BPath(&aEntry);
BPath( &aEntry ).GetParent(&newPath);
if ( (strcmp( fPfad.Path(), newPath.Path() ) != 0 ) ) {
if ( didntshow_msgmultidir ) {
BAlert* myAlert = new BAlert(NULL, MESSAGE_MULTIDIR, STR_OK);
myAlert->Go();
didntshow_msgmultidir = false;
}
continue;
}
// Werte auslesen
if (aEntry.IsFile()) aEntry.GetSize(&size);
else
if (aEntry.IsSymLink()) size = -1;
else
if (aEntry.IsDirectory()) size = -2;
else continue;
aEntry.GetModificationTime(&timer);
fList->AddItem(new FileListItem(aPath.Leaf(), size, timer, &ref));
}
fWindow->Lock();
fListView->AddList(fList);
float Hoehe = be_plain_font->Size() + 2;
if (Hoehe < 18) {
BListItem* myListItem;
for (int i=0; (myListItem = fListView->ItemAt(i)); i++) myListItem->SetHeight(18);
// Zum Updaten:
fListView->AddItem(myListItem = new BStringItem(""));
fListView->RemoveItem(myListItem);
}
fStatusBar->Reset(STATUS_STATUS);
fStatusBar->SetMaxValue(fList->CountItems());
fWindow->Unlock();
MakeList();
}
fWindow->Activate();
UpdateWindowStatus();
}
示例3: CopyDirectory
void GenesisCopyWindow::CopyDirectory(const char *dirname, const char *destination, const char *destdirname)
////////////////////////////////////////////////////////////////////////
{
BEntry srcentry(dirname);
BEntry dstentry;
char name[B_FILE_NAME_LENGTH];
BString fulldestdir;
if (srcentry.InitCheck()!=B_OK)
return;
if (!srcentry.Exists())
return;
srcentry.GetName(name);
fulldestdir.SetTo(destination);
if (destdirname)
fulldestdir << "/" << destdirname;
else
fulldestdir << "/" << name;
dstentry.SetTo(fulldestdir.String());
if (dstentry.InitCheck()!=B_OK)
return;
if (!dstentry.Exists())
{
if (create_directory(fulldestdir.String(), 0777)!=B_OK) // TODO: jo a 0777?
return;
}
BDirectory dir;
dir.SetTo(dirname);
if (dir.InitCheck()==B_OK)
{
BEntry entry;
if (dir.GetEntry(&entry)==B_OK)
{
while (dir.GetNextEntry(&entry)==B_OK)
{
entry.GetName(name);
if (entry.IsDirectory())
{
BString fullname;
fullname.SetTo(dirname);
fullname << "/" << name;
CopyDirectory(fullname.String(), fulldestdir.String());
}
else if (entry.IsSymLink())
{
BString fullname;
fullname.SetTo(dirname);
fullname << "/" << name;
CopyLink(fullname.String(), fulldestdir.String());
}
else
{
BString fullname;
fullname.SetTo(dirname);
fullname << "/" << name;
CopyFile(fullname.String(), fulldestdir.String());
}
}
}
}
// Copy attributes...
CopyAttr(dirname, fulldestdir.String());
}