10 examples of 'golang filepath' in Go

Every line of 'golang filepath' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Go code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
54func getFilePath(path string) string {
55 return filepath.Join(os.Getenv("ADT_ARTIFACTS"), path)
56}
118func (fp FilePersister) getFilePath(fileName string) (pathToFile string, fileDir string) {
119 pathToFile = path.Join(fp.PersistPath, fileName)
120 fileDir = path.Dir(pathToFile)
121
122 var err error
123 pathToFile, err = filepath.Abs(pathToFile)
124 if err != nil {
125 return "", ""
126 }
127 if !strings.HasPrefix(pathToFile, fp.PersistPath) {
128 log.Printf("File path not under the persist path. FilePath: %s, PersistPath %s", pathToFile, fp.PersistPath)
129 return "", ""
130 }
131
132 return pathToFile, fileDir
133}
103func (u *UpdaterConf) getFilePath(filename string) string {
104 return filepath.Join(u.silverDir, filename)
105}
23func GetFilePath(fileName string) string {
24 cwd, _ := os.Getwd()
25 return filepath.Join(cwd, fileName)
26}
83func GetFilePathByMd5(md5 string) string {
84 dig1 := strings.ToUpper(md5[0:2])
85 dig2 := strings.ToUpper(md5[2:4])
86 return app.BasePath + "/data/" + dig1 + "/" + dig2 + "/" + md5
87}
36func (m *Parks) GetFilePath() string {
37 return filepath.Join(m.inputDir, "Parks.csv")
38}
39func (m *HomeGames) GetFilePath() string {
40 return filepath.Join(m.inputDir, "HomeGames.csv")
41}
625func (nr *nodeRunner) getNodesFileName() (string, error) {
626 flagsConfig := nr.configs.FlagsConfig
627 configurationPaths := nr.configs.ConfigurationPathsHolder
628 nodesFileName := configurationPaths.Nodes
629
630 exportFolder := filepath.Join(flagsConfig.WorkingDir, nr.configs.GeneralConfig.Hardfork.ImportFolder)
631 if nr.configs.GeneralConfig.Hardfork.AfterHardFork {
632 exportFolderNodesSetupPath := filepath.Join(exportFolder, core.NodesSetupJsonFileName)
633 if !core.DoesFileExist(exportFolderNodesSetupPath) {
634 return "", fmt.Errorf("cannot find %s in the export folder", core.NodesSetupJsonFileName)
635 }
636
637 nodesFileName = exportFolderNodesSetupPath
638 }
639 return nodesFileName, nil
640}
45func GetFilePath(input_dir string, fileName string) string {
46 return filepath.Join(os.Getenv("PWD"), input_dir, fileName)
47}
48func (record *memoryUsageRecord) getFilename() string {
49 timestamp := record.timestamp.Format("20060102150405")
50 inUse := core.ConvertBytes(record.stats.HeapInuse)
51 inUse = strings.ReplaceAll(inUse, " ", "_")
52 inUse = strings.ReplaceAll(inUse, ".", "_")
53 filename := fmt.Sprintf("mem__%s__%s.pprof", timestamp, inUse)
54 return path.Join(record.parentFolder, filename)
55}

Related snippets