void DialogNewVolume::OnOK() { if ( GetVolumeName().isEmpty()) { QMessageBox::warning( this, "Error", "Volume name can not be empty." ); return; } accept(); }
int nglPath::GetChildren (std::list<nglPath>& rChildren) const { nglString volume = GetVolumeName(); if (!volume.IsEmpty()) { nglVolume* pVolume = nglVolume::GetVolume(volume); if (pVolume) return pVolume->GetChildren(*this, rChildren); } int count = 0; if (mPathName.IsNull()) { return -1; } std::string str(mPathName.GetStdString()); const char* nodename = str.c_str(); DIR* dir; dir = opendir (nodename); if (dir == NULL) { // switch (errno) // { // case EACCES: SetError ("path", NGL_PATH_EACCESS); break; // case ENOENT: SetError ("path", NGL_PATH_EEXIST); break; // case EMFILE: SetError ("path", NGL_PATH_EPROCMAX); break; // case ENFILE: SetError ("path", NGL_PATH_ESYSMAX); break; // case ENOTDIR: SetError ("path", NGL_PATH_ELEAF); break; // } return -1; } struct dirent* entry; while ((entry = readdir (dir))) { if (strcmp (entry->d_name, ".") && strcmp (entry->d_name, "..")) { //printf("nglpath - base = '%s' - child = '%s'\n", GetChars(), entry->d_name); nglPath path = *this; path += nglPath(entry->d_name); rChildren.push_back (path); count++; } } closedir (dir); return count; }
// Given a root path like "C:\", this function // obtains the volume name and returns a complete display string // like "BOOT (C:)". CString FormatVolumeNameOfRootPath(CString rootPath) { CString ret; CString volumeName; bool b = GetVolumeName(rootPath, volumeName); if(b) { ret = FormatVolumeName(rootPath, volumeName); } else { ret = rootPath; } return ret; }
void CVolume::_InitError() { m_sLastError = "This " Volume_string ", "; m_sLastError.Append(GetVolumeName()); m_sLastError.Append(",\n"); }