diff options
Diffstat (limited to 'feed')
-rw-r--r-- | feed/feed.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/feed/feed.go b/feed/feed.go index 631783b..3872af4 100644 --- a/feed/feed.go +++ b/feed/feed.go @@ -19,12 +19,17 @@ type Feed struct { Id string `json:"id"` Source string `json:"source"` Schema string `json:"schema"` + YDLPath string DumpDir string Object interface{} } -func (feed *Feed) Validate(baseDumpDir string) error { - _, err := os.Stat(baseDumpDir) +func (feed *Feed) Validate(ydlPath, baseDumpDir string) error { + _, err := os.Stat(ydlPath) + if err != nil { + return err + } + _, err = os.Stat(baseDumpDir) if err != nil { return err } @@ -51,6 +56,9 @@ func (feed *Feed) Validate(baseDumpDir string) error { feed.Schema, feed.Id) } + // Set ydl-path for feed. + feed.YDLPath = ydlPath + // Set dump directory for feed and ensure it exists. feed.DumpDir = path.Join(baseDumpDir, feed.Id) err = os.MkdirAll(feed.DumpDir, 0755) |