Exemple #1
0
    void SessionModel::populate(Session::Type type, const QString &path) {
        // read session files
        QDir dir(path);
        dir.setNameFilters(QStringList() << "*.desktop");
        dir.setFilter(QDir::Files);
        // read session
        foreach(const QString &session, dir.entryList()) {
            if (!dir.exists(session))
                continue;

            Session *si = new Session(type, session);
            bool execAllowed = true;
            QFileInfo fi(si->tryExec());
            if (fi.isAbsolute()) {
                if (!fi.exists() || !fi.isExecutable())
                    execAllowed = false;
            } else {
                execAllowed = false;
                QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
                QString envPath = env.value("PATH");
                QStringList pathList = envPath.split(':');
                foreach(const QString &path, pathList) {
                    QDir pathDir(path);
                    fi.setFile(pathDir, si->tryExec());
                    if (fi.exists() && fi.isExecutable()) {
                        execAllowed = true;
                        break;
                    }
                }
            }
            // add to sessions list
            if (execAllowed)
                d->sessions.push_back(si);
        }
void ProjectPanel::recursiveAddFilesFrom(const TCHAR *folderPath, HTREEITEM hTreeItem)
{
    bool isRecursive = true;
    bool isInHiddenDir = false;
    generic_string dirFilter(folderPath);
    if (folderPath[lstrlen(folderPath)-1] != '\\')
        dirFilter += TEXT("\\");

    dirFilter += TEXT("*.*");
    WIN32_FIND_DATA foundData;
    std::vector<generic_string> files;

    HANDLE hFile = ::FindFirstFile(dirFilter.c_str(), &foundData);

    do {
        if (hFile == INVALID_HANDLE_VALUE)
            break;

        if (foundData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
        {
            if (!isInHiddenDir && (foundData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN))
            {
                // do nothing
            }
            else if (isRecursive)
            {
                if ((lstrcmp(foundData.cFileName, TEXT("."))) && (lstrcmp(foundData.cFileName, TEXT(".."))))
                {
                    generic_string pathDir(folderPath);
                    if (folderPath[lstrlen(folderPath)-1] != '\\')
                        pathDir += TEXT("\\");
                    pathDir += foundData.cFileName;
                    pathDir += TEXT("\\");
                    HTREEITEM addedItem = addFolder(hTreeItem, foundData.cFileName);
                    recursiveAddFilesFrom(pathDir.c_str(), addedItem);
                }
            }
        }
        else
        {
            files.push_back(foundData.cFileName);
        }
    } while (::FindNextFile(hFile, &foundData));

    for (size_t i = 0, len = files.size() ; i < len ; ++i)
    {
        generic_string pathFile(folderPath);
        if (folderPath[lstrlen(folderPath)-1] != '\\')
            pathFile += TEXT("\\");
        pathFile += files[i];
        _treeView.addItem(files[i].c_str(), hTreeItem, INDEX_LEAF, pathFile.c_str());
    }

    ::FindClose(hFile);
}
Exemple #3
0
bool ABSHandler::setUpBuildingEnvironment(const QString &package, const QString &p)
{
    QString path = p;

    if ( !path.endsWith( QChar( '/' ) ) ) {
        path.append( QChar( '/' ) );
    }

    path.append( package );

    QDir pathDir( path );
    if ( pathDir.exists() ) {
        cleanBuildingEnvironment( package, path );
    }

    if ( !pathDir.mkpath( path ) ) {
        return false;
    }

    QString abspath( getABSPath( package ) );

    if ( abspath.isEmpty() ) {
        qDebug() << "Couldn't find a matching ABS Dir!!";
        return false;
    }

    QDir absPDir( abspath );
    absPDir.setFilter( QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot | QDir::NoSymLinks );

    QFileInfoList Plist = absPDir.entryInfoList();

    for ( int i = 0; i < Plist.size(); ++i ) {
        QString dest( path );
        if ( !dest.endsWith( QChar( '/' ) ) )
            dest.append( QChar( '/' ) );
        dest.append( Plist.at( i ).fileName() );

        qDebug() << "Copying " << Plist.at( i ).absoluteFilePath() << " to " << dest;

        if ( !QFile::copy( Plist.at( i ).absoluteFilePath(), dest ) ) {
            return false;
        }
    }

    return true;
}
Exemple #4
0
// This constructor is for use by HdfsRdwrMemBuffer to create a file buffer when we
// run out of memory.
HdfsRdwrFileBuffer::HdfsRdwrFileBuffer(HdfsRdwrMemBuffer* pMemBuffer) throw (std::exception) :
    IDBDataFile(pMemBuffer->name().c_str()),
    m_buffer(NULL),
    m_dirty(false)
{
    // we have been asked to replace memory buffered rw operations with file buffered
    // operations on a file that currently exists in HDFS.

    // Set up the local directory that we need to write to
    string bufname = IDBPolicy::hdfsRdwrScratch() + name();
    boost::filesystem::path pathDir(bufname);

    // this will create the directory we want to work in
    if( IDBPolicy::mkdir(pathDir.parent_path().string().c_str()) != 0 )
    {
        ostringstream oss;
        oss << "MemBuffer overflow. Unable to create directory path: " << pathDir.parent_path();
        throw std::runtime_error(oss.str());
    }

    m_buffer = new BufferedFile( bufname.c_str(), "w+", IDBDataFile::USE_VBUF );

    // Dump the contents of the memory buffer into the file
    const unsigned char* membuffer = pMemBuffer->getbuffer();
    ssize_t bytesToProcess = pMemBuffer->size();
    ssize_t bytesProcessed = 0;
    while (bytesToProcess > 0)
    {
        bytesProcessed = m_buffer->write( membuffer, bytesToProcess );
        if (bytesProcessed < 0 && errno != EINTR)
        {
            ostringstream oss;
            oss << "MemBuffer overflow. Error while writing: " << pathDir << " " << strerror(errno);
            throw std::runtime_error(oss.str());
        }
        membuffer += bytesProcessed;
        bytesToProcess -= bytesProcessed;
    }
}
/**
 * Determine the file name.
 * @param concept   the package
 * @param ext       the file extension
 * @return the valid file name
 */
QString SimpleCodeGenerator::findFileName(UMLPackage* concept, const QString &ext)
{
    //if we already know to which file this class was written/should be written, just return it.
    if (m_fileMap.contains(concept))
        return m_fileMap[concept];

    //else, determine the "natural" file name
    QString name;
    // Get the package name
    QString package = concept->package(".");

    // Replace all white spaces with blanks
    package = package.simplified();

    // Replace all blanks with underscore
    package.replace(QRegExp(" "), "_");

    // Convert all "::" to "/" : Platform-specific path separator
    // package.replace(QRegExp("::"), "/");

    // if package is given add this as a directory to the file name
    if (!package.isEmpty() && m_createDirHierarchyForPackages) {
        name = package + '.' + concept->name();
        name.replace(QRegExp("\\."),"/");
        package.replace(QRegExp("\\."), "/");
        package = '/' + package;
    } else {
        name = concept->fullyQualifiedName("-");
    }

    if (! UMLApp::app()->activeLanguageIsCaseSensitive()) {
        package = package.toLower();
        name = name.toLower();
    }

    // if a package name exists check the existence of the package directory
    if (!package.isEmpty() && m_createDirHierarchyForPackages) {
        QDir pathDir(UMLApp::app()->commonPolicy()->getOutputDirectory().absolutePath() + package);
        // does our complete output directory exist yet? if not, try to create it
        if (!pathDir.exists())
        {
            const QStringList dirs = pathDir.absolutePath().split('/');
            QString currentDir = "";

            QStringList::const_iterator end(dirs.end());
            for (QStringList::const_iterator dir(dirs.begin()); dir != end; ++dir)
            {
                currentDir += '/' + *dir;
                if (! (pathDir.exists(currentDir)
                        || pathDir.mkdir(currentDir) ) )
                {
                    KMessageBox::error(0, i18n("Cannot create the folder:\n") +
                                       pathDir.absolutePath() + i18n("\nPlease check the access rights"),
                                       i18n("Cannot Create Folder"));
                    return NULL;
                }
            }
        }
    }

    name = name.simplified();
    name.replace(QRegExp(" "),"_");

    QString extension = ext.simplified();
    extension.replace(' ', '_');

    return overwritableName(concept, name, extension);
}
void FileBrowser::getDirectoryStructure(const TCHAR *dir, const std::vector<generic_string> & patterns, FolderInfo & directoryStructure, bool isRecursive, bool isInHiddenDir)
{
	if (directoryStructure._parent == nullptr) // Root!
		directoryStructure.setRootPath(dir);

	generic_string dirFilter(dir);
	if (dirFilter[dirFilter.length() - 1] != '\\')
		dirFilter += TEXT("\\");
	dirFilter += TEXT("*.*");
	WIN32_FIND_DATA foundData;

	HANDLE hFile = ::FindFirstFile(dirFilter.c_str(), &foundData);

	if (hFile != INVALID_HANDLE_VALUE)
	{

		if (foundData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
		{
			if (!isInHiddenDir && (foundData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN))
			{
				// do nothing
			}
			else if (isRecursive)
			{
				if ((lstrcmp(foundData.cFileName, TEXT("."))) && (lstrcmp(foundData.cFileName, TEXT(".."))))
				{
					generic_string pathDir(dir);
					if (pathDir[pathDir.length() - 1] != '\\')
						pathDir += TEXT("\\");
					pathDir += foundData.cFileName;
					pathDir += TEXT("\\");

					FolderInfo subDirectoryStructure(foundData.cFileName, &directoryStructure);
					getDirectoryStructure(pathDir.c_str(), patterns, subDirectoryStructure, isRecursive, isInHiddenDir);
					directoryStructure.addSubFolder(subDirectoryStructure);
				}
			}
		}
		else
		{
			if (matchInList(foundData.cFileName, patterns))
			{
				directoryStructure.addFile(foundData.cFileName);
			}
		}
	}

	while (::FindNextFile(hFile, &foundData))
	{
		if (foundData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
		{
			if (!isInHiddenDir && (foundData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN))
			{
				// do nothing
			}
			else if (isRecursive)
			{
				if ((lstrcmp(foundData.cFileName, TEXT("."))) && (lstrcmp(foundData.cFileName, TEXT(".."))))
				{
					generic_string pathDir(dir);
					if (pathDir[pathDir.length() - 1] != '\\')
						pathDir += TEXT("\\");
					pathDir += foundData.cFileName;
					pathDir += TEXT("\\");

					FolderInfo subDirectoryStructure(foundData.cFileName, &directoryStructure);
					getDirectoryStructure(pathDir.c_str(), patterns, subDirectoryStructure, isRecursive, isInHiddenDir);
					directoryStructure.addSubFolder(subDirectoryStructure);
				}
			}
		}
		else
		{
			if (matchInList(foundData.cFileName, patterns))
			{
				directoryStructure.addFile(foundData.cFileName);
			}
		}
	}
	::FindClose(hFile);
}
bool ItemRepositoryRegistry::open(const QString& path, bool clear, KLockFile::Ptr lock) {
  QMutexLocker mlock(&m_mutex);
  if(m_path == path && !clear)
    return true;
  
  m_lock = lock;
  m_path = path;

  bool needRepoCheck = true;
  
  while(needRepoCheck) {

    if(QFile::exists(m_path + "/is_writing")) {
      kWarning() << "repository" << m_path << "was write-locked, it probably is inconsistent";
      clear = true;
    }
  
    QDir pathDir(m_path);
    pathDir.setFilter(QDir::Files);
    
    //When there is only one file in the repository, it's the lock-file, and the repository has just been cleared
    if(pathDir.count() != 1)
    {
      if(!QFile::exists( m_path + QString("/version_%1").arg(staticItemRepositoryVersion()) ))
      {
      kWarning() << "version-hint not found, seems to be an old version";
      clear = true;
      }else if(getenv("CLEAR_DUCHAIN_DIR"))
      {
        kWarning() << "clearing duchain directory because CLEAR_DUCHAIN_DIR is set";
        clear = true;
      }
    }
    
    QFile crashesFile(m_path + QString("/crash_counter"));
    if(crashesFile.open(QIODevice::ReadOnly)) {
      int count;
      QDataStream stream(&crashesFile);
      stream >> count;

      kDebug() << "current count of crashes: " << count;
      
      if(count >= crashesBeforeCleanup && !getenv("DONT_CLEAR_DUCHAIN_DIR"))
      {
        int userAnswer = 0;
        ///NOTE: we don't want to crash our beloved tools when run in no-gui mode
        ///NOTE 2: create a better, reusable version of the below for other tools
        if (QApplication::type() == QApplication::Tty) {
          // no ui-mode e.g. for duchainify and other tools
          QTextStream out(stdout);
          out << i18np("Session crashed %1 time in a row", "Session crashed %1 times in a row", count) << endl;
          out << endl;
          QTextStream in(stdin);
          QString input;
          while(true) {
            out << i18n("Clear cache: [Y/n] ") << flush;
            input = in.readLine().trimmed();
            if (input.toLower() == "y" || input.isEmpty()) {
              userAnswer = KMessageBox::Yes;
              break;
            } else if (input.toLower() == "n") {
              userAnswer = KMessageBox::No;
              break;
            }
          }
        } else {
          userAnswer = KMessageBox::questionYesNo(0,
            i18np("The Session crashed once.", "The Session crashed %1 times in a row.", count) + "\n\n" + i18n("The crash may be caused by a corruption of cached data.\n\nPress OK if you want KDevelop to clear the cache, otherwise press Cancel if you are sure the crash has another origin."),
            i18n("Session crashed"),
            KStandardGuiItem::ok(),
            KStandardGuiItem::cancel());
        }
        if (userAnswer == KMessageBox::Yes) {
          clear = true;
          kDebug() << "User chose to clean repository";
        } else {
          setCrashCounter(crashesFile, 1);
          kDebug() << "User chose to reset crash counter";
        }
      }else{
        ///Increase the crash-count. It will be reset if kdevelop is shut down cleanly.
        setCrashCounter(crashesFile, ++count);
      }
    }else{
Exemple #8
0
HdfsRdwrFileBuffer::HdfsRdwrFileBuffer(const char* fname, const char* mode, unsigned opts) :
    IDBDataFile(fname),
    m_buffer(NULL),
    m_dirty(false),
    m_new(false)
{
    // we have been asked to support rw operations on a file that currently
    // exists in HDFS by using a local file buffer.

    IDBFileSystem& fs = IDBFactory::getFs( HDFS );

    // append an extra tmp extension if USE_TMPFILE extension is set.
    string input(fname);
    if (opts & USE_TMPFILE)
    {
        m_fname += ".tmp";   // use .tmp as working copy to replace the ".hdr/chk" backup.
        if (IDBPolicy::exists(m_fname.c_str()))
            input = m_fname; // get from .tmp if revisit
        else
            m_new = true;
    }

    // cache the size first - we will use this to determine if the
    // file already exists and needs to be read into the buffer
    off64_t size = fs.size(input.c_str());

    // first we will try to open the file for writing - if this fails
    // it means we can't actually open the file for writing and need
    // to throw exception anyway
    bool truncate = (mode != NULL && *mode == 'w');
    if( size < 0 || truncate)
    {
        HdfsFile* trywrite = new HdfsFile(input.c_str(), "w", 0);
        delete trywrite;

        size = 0;
    }

    // if we get here, then will be ok to write later.  First we
    // we set up the local directory that we need to write to
    string bufname = IDBPolicy::hdfsRdwrScratch() + input;
    boost::filesystem::path pathDir(bufname);

    // this will create the directory we want to work in
    if( IDBPolicy::mkdir(pathDir.parent_path().string().c_str()) != 0 )
    {
        ostringstream oss;
        oss << "Unable to create directory path: " << pathDir.parent_path();
        throw std::runtime_error(oss.str());
    }

    m_buffer = new BufferedFile( bufname.c_str(), "w+", IDBDataFile::USE_VBUF );

    // Now we need to
    // open one for reading if the file existed previously
    if( size > 0 )
    {
        HdfsFile tryread(input.c_str(), "r", 0);

        boost::scoped_array<unsigned char> buffer(new unsigned char[BUFSIZE]);
        ssize_t bytesProcessed = 0;
        while(bytesProcessed < (ssize_t) size)
        {
            ssize_t bytesRead = tryread.read( buffer.get(), BUFSIZE );
            m_buffer->write( buffer.get(), bytesRead );
            bytesProcessed += bytesRead;
        }
        m_buffer->seek(0,SEEK_SET);
    }
    else
    {
        // in this case there is no existing file to read and nothing else to do
        ;
    }
}
void FileSystemController::service(HttpRequest& request, HttpResponse& response)
{
	if (!CheckCreditinals(request, response))
	{
		return;
	}

	QString method = request.getMethod();

	if (method.compare("GET", Qt::CaseInsensitive) == 0)
	{
		QString currentPath = request.getParameter("currentPath");
		currentPath = QUrl::fromPercentEncoding(currentPath.toUtf8());
		QtJson::JsonArray respJson;

		if (!currentPath.isEmpty())
		{
			QDir pathDir(currentPath);

			if (pathDir.exists())
			{
				QStringList subdirsList = pathDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);

				for (int i = 0; i < subdirsList.count(); i++)
				{
					QtJson::JsonObject dir;
					dir["type"] = "dir";
					dir["name"] = subdirsList[i];
					respJson.append(dir);
				}
			}
			else
			{
				QtJson::JsonObject errObj;
				errObj["type"] = "err";
				errObj["msg"] = "Path doesnot exist";
				respJson.append(errObj);
			}
		}
		else
		{
			QList<QStorageInfo> volumes = QStorageInfo::mountedVolumes();

			for (int i = 0; i < volumes.count(); i++)
			{
				QtJson::JsonObject drive;
				drive["type"] = "drive";
				drive["freeSpace"] = StaticHelpers::toKbMbGb(volumes[i].bytesFree());
				drive["size"] = StaticHelpers::toKbMbGb(volumes[i].bytesTotal());
				drive["name"] = volumes[i].rootPath();
				respJson.append(drive);
			}
		}

		response.setHeader("Content-Type", "application/json");
		response.write(QtJson::serialize(respJson));
	}
	else
	{
		response.setStatus(405, "Method Not Allowed");
		response.write("<BODY><h3>405 Method Not Allowed.</h3>");
		response.write("</BODY>");
	}
}
Exemple #10
0
// InitTest1
void
SymLinkTest::InitTest1()
{
	const char *dirLink = dirLinkname;
	const char *dirSuperLink = dirSuperLinkname;
	const char *dirRelLink = dirRelLinkname;
	const char *fileLink = fileLinkname;
	const char *existingDir = existingDirname;
	const char *existingSuperDir = existingSuperDirname;
	const char *existingRelDir = existingRelDirname;
	const char *existingFile = existingFilename;
	const char *existingSuperFile = existingSuperFilename;
	const char *existingRelFile = existingRelFilename;
	const char *nonExisting = nonExistingDirname;
	const char *nonExistingSuper = nonExistingSuperDirname;
	const char *nonExistingRel = nonExistingRelDirname;
	// 1. default constructor
	NextSubTest();
	{
		BSymLink link;
		CPPUNIT_ASSERT( link.InitCheck() == B_NO_INIT );
	}

	// 2. BSymLink(const char*)
	NextSubTest();
	{
		BSymLink link(fileLink);
		CPPUNIT_ASSERT( link.InitCheck() == B_OK );
	}
	NextSubTest();
	{
		BSymLink link(nonExisting);
		CPPUNIT_ASSERT( link.InitCheck() == B_ENTRY_NOT_FOUND );
	}
	NextSubTest();
	{
		BSymLink link((const char *)NULL);
		CPPUNIT_ASSERT( equals(link.InitCheck(), B_BAD_VALUE, B_NO_INIT) );
	}
	NextSubTest();
	{
		BSymLink link("");
		CPPUNIT_ASSERT( link.InitCheck() == B_ENTRY_NOT_FOUND );
	}
	NextSubTest();
	{
		BSymLink link(existingFile);
		CPPUNIT_ASSERT( link.InitCheck() == B_OK );
	}
	NextSubTest();
	{
		BSymLink link(existingDir);
		CPPUNIT_ASSERT( link.InitCheck() == B_OK );
	}
	NextSubTest();
	{
		BSymLink link(tooLongEntryname);
		CPPUNIT_ASSERT( link.InitCheck() == B_NAME_TOO_LONG );
	}

	// 3. BSymLink(const BEntry*)
	NextSubTest();
	{
		BEntry entry(dirLink);
		CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
		BSymLink link(&entry);
		CPPUNIT_ASSERT( link.InitCheck() == B_OK );
	}
	NextSubTest();
	{
		BEntry entry(nonExisting);
		CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
		BSymLink link(&entry);
		CPPUNIT_ASSERT( link.InitCheck() == B_ENTRY_NOT_FOUND );
	}
	NextSubTest();
	{
		BSymLink link((BEntry *)NULL);
		CPPUNIT_ASSERT( link.InitCheck() == B_BAD_VALUE );
	}
	NextSubTest();
	{
		BEntry entry;
		BSymLink link(&entry);
		CPPUNIT_ASSERT( equals(link.InitCheck(), B_BAD_ADDRESS, B_BAD_VALUE) );
	}
	NextSubTest();
	{
		BEntry entry(existingFile);
		CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
		BSymLink link(&entry);
		CPPUNIT_ASSERT( link.InitCheck() == B_OK );

	}
	NextSubTest();
	{
		BEntry entry(existingDir);
		CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
		BSymLink link(&entry);
		CPPUNIT_ASSERT( link.InitCheck() == B_OK );

	}
	NextSubTest();
	{
		BEntry entry(tooLongEntryname);
		// R5 returns E2BIG instead of B_NAME_TOO_LONG
		CPPUNIT_ASSERT( equals(entry.InitCheck(), E2BIG, B_NAME_TOO_LONG) );
		BSymLink link(&entry);
		CPPUNIT_ASSERT( equals(link.InitCheck(), B_BAD_ADDRESS, B_BAD_VALUE) );
	}

	// 4. BSymLink(const entry_ref*)
	NextSubTest();
	{
		BEntry entry(dirLink);
		CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
		entry_ref ref;
		CPPUNIT_ASSERT( entry.GetRef(&ref) == B_OK );
		BSymLink link(&ref);
		CPPUNIT_ASSERT( link.InitCheck() == B_OK );
	}
	NextSubTest();
	{
		BEntry entry(nonExisting);
		CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
		entry_ref ref;
		CPPUNIT_ASSERT( entry.GetRef(&ref) == B_OK );
		BSymLink link(&ref);
		CPPUNIT_ASSERT( link.InitCheck() == B_ENTRY_NOT_FOUND );
	}
	NextSubTest();
	{
		BSymLink link((entry_ref *)NULL);
		CPPUNIT_ASSERT( link.InitCheck() == B_BAD_VALUE );
	}
	NextSubTest();
	{
		BEntry entry(existingFile);
		CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
		entry_ref ref;
		CPPUNIT_ASSERT( entry.GetRef(&ref) == B_OK );
		BSymLink link(&ref);
		CPPUNIT_ASSERT( link.InitCheck() == B_OK );
	}
	NextSubTest();
	{
		BEntry entry(existingDir);
		CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
		entry_ref ref;
		CPPUNIT_ASSERT( entry.GetRef(&ref) == B_OK );
		BSymLink link(&ref);
		CPPUNIT_ASSERT( link.InitCheck() == B_OK );
	}

	// 5. BSymLink(const BDirectory*, const char*)
	NextSubTest();
	{
		BDirectory pathDir(dirSuperLink);
		CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK );
		BSymLink link(&pathDir, dirRelLink);
		CPPUNIT_ASSERT( link.InitCheck() == B_OK );
	}
	NextSubTest();
	{
		BDirectory pathDir(dirSuperLink);
		CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK );
		BSymLink link(&pathDir, dirLink);
		CPPUNIT_ASSERT( link.InitCheck() == B_BAD_VALUE );
	}
	NextSubTest();
	{
		BDirectory pathDir(nonExistingSuper);
		CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK );
		BSymLink link(&pathDir, nonExistingRel);
		CPPUNIT_ASSERT( link.InitCheck() == B_ENTRY_NOT_FOUND );
	}
	NextSubTest();
	{
		BSymLink link((BDirectory *)NULL, (const char *)NULL);
		CPPUNIT_ASSERT( link.InitCheck() == B_BAD_VALUE );
	}
	NextSubTest();
	{
		BSymLink link((BDirectory *)NULL, dirLink);
		CPPUNIT_ASSERT( link.InitCheck() == B_BAD_VALUE );
	}
	NextSubTest();
	{
		BDirectory pathDir(dirSuperLink);
		CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK );
		BSymLink link(&pathDir, (const char *)NULL);
		CPPUNIT_ASSERT( link.InitCheck() == B_BAD_VALUE );
	}
	NextSubTest();
	{
		BDirectory pathDir(dirSuperLink);
		CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK );
		BSymLink link(&pathDir, "");
		CPPUNIT_ASSERT( link.InitCheck() == B_OK );
	}
	NextSubTest();
	{
		BDirectory pathDir(existingSuperFile);
		CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK );
		BSymLink link(&pathDir, existingRelFile);
		CPPUNIT_ASSERT( link.InitCheck() == B_OK );
	}
	NextSubTest();
	{
		BDirectory pathDir(existingSuperDir);
		CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK );
		BSymLink link(&pathDir, existingRelDir);
		CPPUNIT_ASSERT( link.InitCheck() == B_OK );
	}
	NextSubTest();
	{
		BDirectory pathDir(tooLongSuperEntryname);
		CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK );
		BSymLink link(&pathDir, tooLongRelEntryname);
		CPPUNIT_ASSERT( link.InitCheck() == B_NAME_TOO_LONG );
	}
	NextSubTest();
	{
		BDirectory pathDir(fileSuperDirname);
		CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK );
		BSymLink link(&pathDir, fileRelDirname);
		CPPUNIT_ASSERT( link.InitCheck() == B_ENTRY_NOT_FOUND );
	}
}