diff options
author | Bjørn Erik Pedersen <[email protected]> | 2022-04-17 10:35:01 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2022-04-17 10:35:01 +0200 |
commit | 6c35a1a9eacf2aa86a11ecd31c4022ce330b2f16 (patch) | |
tree | c390750370d67e646446bdc64c22b430aeb1292c /hugofs | |
parent | 363bc907c0ab4b6989bada2e1ffca4ef17d7b8a4 (diff) | |
download | hugo-6c35a1a9eacf2aa86a11ecd31c4022ce330b2f16.tar.gz hugo-6c35a1a9eacf2aa86a11ecd31c4022ce330b2f16.zip |
Revert "Fix PostProcess regression for hugo server"
This reverts commit 4deb5c60661bdb1d686664f0207f45517a086f29.
Diffstat (limited to 'hugofs')
-rw-r--r-- | hugofs/fs.go | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/hugofs/fs.go b/hugofs/fs.go index 63c25a4c0..436387f13 100644 --- a/hugofs/fs.go +++ b/hugofs/fs.go @@ -65,7 +65,7 @@ type Fs struct { // as source and destination file systems. func NewDefault(cfg config.Provider) *Fs { fs := Os - return newFs(fs, fs, cfg) + return newFs(fs, cfg) } // NewMem creates a new Fs with the MemMapFs @@ -73,23 +73,17 @@ func NewDefault(cfg config.Provider) *Fs { // Useful for testing. func NewMem(cfg config.Provider) *Fs { fs := &afero.MemMapFs{} - return newFs(fs, fs, cfg) + return newFs(fs, cfg) } // NewFrom creates a new Fs based on the provided Afero Fs // as source and destination file systems. // Useful for testing. func NewFrom(fs afero.Fs, cfg config.Provider) *Fs { - return newFs(fs, fs, cfg) + return newFs(fs, cfg) } -// NewFrom creates a new Fs based on the provided Afero Fss -// as the source and destination file systems. -func NewFromSourceAndDestination(source, destination afero.Fs, cfg config.Provider) *Fs { - return newFs(source, destination, cfg) -} - -func newFs(source, destination afero.Fs, cfg config.Provider) *Fs { +func newFs(base afero.Fs, cfg config.Provider) *Fs { workingDir := cfg.GetString("workingDir") publishDir := cfg.GetString("publishDir") if publishDir == "" { @@ -97,27 +91,27 @@ func newFs(source, destination afero.Fs, cfg config.Provider) *Fs { } // Sanity check - if IsOsFs(source) && len(workingDir) < 2 { + if IsOsFs(base) && len(workingDir) < 2 { panic("workingDir is too short") } absPublishDir := paths.AbsPathify(workingDir, publishDir) // Make sure we always have the /public folder ready to use. - if err := source.MkdirAll(absPublishDir, 0777); err != nil && !os.IsExist(err) { + if err := base.MkdirAll(absPublishDir, 0777); err != nil && !os.IsExist(err) { panic(err) } - pubFs := afero.NewBasePathFs(destination, absPublishDir) + pubFs := afero.NewBasePathFs(base, absPublishDir) return &Fs{ - Source: source, + Source: base, PublishDir: pubFs, PublishDirServer: pubFs, PublishDirStatic: pubFs, Os: &afero.OsFs{}, - WorkingDirReadOnly: getWorkingDirFsReadOnly(source, workingDir), - WorkingDirWritable: getWorkingDirFsWritable(source, workingDir), + WorkingDirReadOnly: getWorkingDirFsReadOnly(base, workingDir), + WorkingDirWritable: getWorkingDirFsWritable(base, workingDir), } } |