mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 15:37:35 +08:00
fix: create results dir
This commit is contained in:
+16
-11
@@ -63,20 +63,14 @@ func GetConfig() *Config {
|
|||||||
cfg.downloadsPath = filepath.Join(cfg.RootDir, filepath.Join(DownloadsDirName, startTimeStr))
|
cfg.downloadsPath = filepath.Join(cfg.RootDir, filepath.Join(DownloadsDirName, startTimeStr))
|
||||||
cfg.screenShotsPath = filepath.Join(cfg.resultsPath, ScreenshotsDirName)
|
cfg.screenShotsPath = filepath.Join(cfg.resultsPath, ScreenshotsDirName)
|
||||||
cfg.actionLogDirPath = filepath.Join(resultsDir, ActionLogDirName)
|
cfg.actionLogDirPath = filepath.Join(resultsDir, ActionLogDirName)
|
||||||
cfg.logFilePath = filepath.Join(cfg.resultsPath, LogFileName)
|
|
||||||
cfg.summaryFilePath = filepath.Join(cfg.resultsPath, SummaryFileName)
|
|
||||||
cfg.reportFilePath = filepath.Join(cfg.resultsPath, ReportFileName)
|
|
||||||
globalConfig = cfg
|
globalConfig = cfg
|
||||||
})
|
})
|
||||||
|
|
||||||
return globalConfig
|
return globalConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResultsPath returns the results path and creates the directory if it doesn't exist
|
// resultsPathUnlocked returns the results path and creates the directory if it doesn't exist (internal use, no lock)
|
||||||
func (c *Config) ResultsPath() string {
|
func (c *Config) resultsPathUnlocked() string {
|
||||||
c.mu.Lock()
|
|
||||||
defer c.mu.Unlock()
|
|
||||||
|
|
||||||
// Check if directory exists, create if it doesn't
|
// Check if directory exists, create if it doesn't
|
||||||
if _, err := os.Stat(c.resultsPath); os.IsNotExist(err) {
|
if _, err := os.Stat(c.resultsPath); os.IsNotExist(err) {
|
||||||
if err := builtin.EnsureFolderExists(c.resultsPath); err != nil {
|
if err := builtin.EnsureFolderExists(c.resultsPath); err != nil {
|
||||||
@@ -88,6 +82,14 @@ func (c *Config) ResultsPath() string {
|
|||||||
return c.resultsPath
|
return c.resultsPath
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ResultsPath returns the results path and creates the directory if it doesn't exist
|
||||||
|
func (c *Config) ResultsPath() string {
|
||||||
|
c.mu.Lock()
|
||||||
|
defer c.mu.Unlock()
|
||||||
|
|
||||||
|
return c.resultsPathUnlocked()
|
||||||
|
}
|
||||||
|
|
||||||
// DownloadsPath returns the downloads path and creates the directory if it doesn't exist
|
// DownloadsPath returns the downloads path and creates the directory if it doesn't exist
|
||||||
func (c *Config) DownloadsPath() string {
|
func (c *Config) DownloadsPath() string {
|
||||||
c.mu.Lock()
|
c.mu.Lock()
|
||||||
@@ -145,7 +147,8 @@ func (c *Config) SummaryFilePath() string {
|
|||||||
return c.summaryFilePath
|
return c.summaryFilePath
|
||||||
}
|
}
|
||||||
|
|
||||||
c.summaryFilePath = filepath.Join(c.ResultsPath(), SummaryFileName)
|
// Ensure directory creation and set cached path
|
||||||
|
c.summaryFilePath = filepath.Join(c.resultsPathUnlocked(), SummaryFileName)
|
||||||
return c.summaryFilePath
|
return c.summaryFilePath
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,7 +161,8 @@ func (c *Config) LogFilePath() string {
|
|||||||
return c.logFilePath
|
return c.logFilePath
|
||||||
}
|
}
|
||||||
|
|
||||||
c.logFilePath = filepath.Join(c.ResultsPath(), LogFileName)
|
// Ensure directory creation and set cached path
|
||||||
|
c.logFilePath = filepath.Join(c.resultsPathUnlocked(), LogFileName)
|
||||||
return c.logFilePath
|
return c.logFilePath
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,6 +175,7 @@ func (c *Config) ReportFilePath() string {
|
|||||||
return c.reportFilePath
|
return c.reportFilePath
|
||||||
}
|
}
|
||||||
|
|
||||||
c.reportFilePath = filepath.Join(c.ResultsPath(), ReportFileName)
|
// Ensure directory creation and set cached path
|
||||||
|
c.reportFilePath = filepath.Join(c.resultsPathUnlocked(), ReportFileName)
|
||||||
return c.reportFilePath
|
return c.reportFilePath
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
v5.0.0-beta-2506152331
|
v5.0.0-beta-2506171409
|
||||||
|
|||||||
Reference in New Issue
Block a user