mirror of
https://github.com/aria2/aria2.git
synced 2026-04-03 03:09:04 +00:00
Now a file is stored in the directory specified in .metalnk file
(file[@name]).
* src/Metalink2RequestGroup.cc
Create the directory structure when opening the file if it
doesn't
exist.
* src/AbstractDiskWriter.cc
* src/Util.{h, cc}
* src/File.h
* test/UtilTest.cc
Removed file name comparison
* src/Metalink2RequestGroup.cc
* src/HttpResponseCommand.cc
Rewritten using Util::mkdirs()
* src/FileEntry.cc (setupDir)
* test/FileEntryTest.cc
Updated doc
* src/SingleFileDownloadContext.h
35 lines
785 B
C++
35 lines
785 B
C++
#include "FileEntry.h"
|
|
#include <cppunit/extensions/HelperMacros.h>
|
|
|
|
class FileEntryTest : public CppUnit::TestFixture {
|
|
|
|
CPPUNIT_TEST_SUITE(FileEntryTest);
|
|
CPPUNIT_TEST(testSetupDir);
|
|
CPPUNIT_TEST_SUITE_END();
|
|
public:
|
|
void setUp() {}
|
|
|
|
void testSetupDir();
|
|
};
|
|
|
|
|
|
CPPUNIT_TEST_SUITE_REGISTRATION( FileEntryTest );
|
|
|
|
void FileEntryTest::testSetupDir()
|
|
{
|
|
string topDir = "/tmp";
|
|
string dir = "aria2-FileEntryTest-testSetupDir";
|
|
string filename = "filename";
|
|
string path = topDir+"/"+dir+"/"+filename;
|
|
File d(topDir+"/"+dir);
|
|
if(d.exists()) {
|
|
CPPUNIT_ASSERT(d.remove());
|
|
}
|
|
CPPUNIT_ASSERT(!d.exists());
|
|
FileEntry fileEntry(dir+"/"+filename, 0, 0);
|
|
fileEntry.setupDir(topDir);
|
|
CPPUNIT_ASSERT(d.isDir());
|
|
File f(path);
|
|
CPPUNIT_ASSERT(!f.exists());
|
|
}
|