Create entry directory when necessary

This commit is contained in:
Jaidyn Ann 2021-03-22 12:11:10 -05:00
parent 1e7579ac08
commit 171de4e440
3 changed files with 8 additions and 8 deletions

View File

@ -10,6 +10,7 @@
#include <StorageKit.h>
#include "App.h"
#include "Util.h"
@ -29,15 +30,15 @@ Entry::~Entry()
bool
Entry::Filetize(BDirectory outDir)
Entry::Filetize()
{
BFile file(fTitle.String(), B_READ_WRITE);
BEntry outDirEntry;
BString outPath = ((App*)be_app)->fPreferences->EntryDir();
BDirectory outDir(outPath.String());
time_t tt_date = fDate.Time_t();
outDir.GetEntry(&outDirEntry);
if (outDir.InitCheck() == B_ENTRY_NOT_FOUND) {
outDir.CreateDirectory(BPath(&outDirEntry).Path(), &outDir);
BDirectory().CreateDirectory(outPath.String(), &outDir);
}
outDir.CreateFile(fTitle.String(), &file);

View File

@ -20,7 +20,7 @@ public:
Entry();
~Entry();
bool Filetize(BDirectory outDir);
bool Filetize();
BString Title();
bool SetTitle(const char*);

View File

@ -256,7 +256,6 @@ FeedController::_ParseLoop(void* data)
int32 entriesCount = 0;
BString feedTitle;
BUrl feedUrl = feedBuffer->XmlUrl();
BDirectory outDir = BDirectory(((App*)be_app)->fPreferences->EntryDir());
if (feedBuffer->IsAtom() && feedBuffer->IsUpdated()) {
AtomFeed feed(feedBuffer);
@ -266,7 +265,7 @@ FeedController::_ParseLoop(void* data)
feedTitle = feed.Title();
for (int i = 0; i < entriesCount; i++)
entries.ItemAt(i)->Filetize(outDir);
entries.ItemAt(i)->Filetize();
entries.MakeEmpty();
}
else if (feedBuffer->IsRss() && feedBuffer->IsUpdated()) {
@ -277,7 +276,7 @@ FeedController::_ParseLoop(void* data)
feedTitle = feed.Title();
for (int i = 0; i < entriesCount; i++)
entries.ItemAt(i)->Filetize(outDir);
entries.ItemAt(i)->Filetize();
entries.MakeEmpty();
}