summaryrefslogtreecommitdiffstats
path: root/commands/commandeer.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/commandeer.go')
-rw-r--r--commands/commandeer.go28
1 files changed, 10 insertions, 18 deletions
diff --git a/commands/commandeer.go b/commands/commandeer.go
index 1162a4b70..c42de5d11 100644
--- a/commands/commandeer.go
+++ b/commands/commandeer.go
@@ -395,23 +395,23 @@ func (c *commandeer) loadConfig() error {
}
c.fsCreate.Do(func() {
- fs := hugofs.NewFrom(sourceFs, config)
+ // Assume both source and destination are using same filesystem.
+ fs := hugofs.NewFromSourceAndDestination(sourceFs, sourceFs, config)
if c.publishDirFs != nil {
// Need to reuse the destination on server rebuilds.
fs.PublishDir = c.publishDirFs
fs.PublishDirServer = c.publishDirServerFs
} else {
- publishDir := config.GetString("publishDir")
- publishDirStatic := config.GetString("publishDirStatic")
- workingDir := config.GetString("workingDir")
- absPublishDir := paths.AbsPathify(workingDir, publishDir)
- absPublishDirStatic := paths.AbsPathify(workingDir, publishDirStatic)
-
if c.renderStaticToDisk {
- // Writes the dynamic output oton memory,
+ publishDirStatic := config.GetString("publishDirStatic")
+ workingDir := config.GetString("workingDir")
+ absPublishDirStatic := paths.AbsPathify(workingDir, publishDirStatic)
+
+ fs = hugofs.NewFromSourceAndDestination(sourceFs, afero.NewMemMapFs(), config)
+ // Writes the dynamic output to memory,
// while serve others directly from /public on disk.
- dynamicFs := afero.NewMemMapFs()
+ dynamicFs := fs.PublishDir
staticFs := afero.NewBasePathFs(afero.NewOsFs(), absPublishDirStatic)
// Serve from both the static and dynamic fs,
@@ -427,18 +427,10 @@ func (c *commandeer) loadConfig() error {
},
},
)
- fs.PublishDir = dynamicFs
fs.PublishDirStatic = staticFs
} else if createMemFs {
// Hugo writes the output to memory instead of the disk.
- fs.PublishDir = new(afero.MemMapFs)
- fs.PublishDirServer = fs.PublishDir
- fs.PublishDirStatic = fs.PublishDir
- } else {
- // Write everything to disk.
- fs.PublishDir = afero.NewBasePathFs(afero.NewOsFs(), absPublishDir)
- fs.PublishDirServer = fs.PublishDir
- fs.PublishDirStatic = fs.PublishDir
+ fs = hugofs.NewFromSourceAndDestination(sourceFs, afero.NewMemMapFs(), config)
}
}