mirror of
https://github.com/luxfi/cli.git
synced 2026-10-30 17:01:20 +00:00
Update CLI for genesis Fix import paths from ethereum/go-ethereum to luxfi/geth - Replace all ethereum/go-ethereum imports with luxfi/geth - Add local rawdb package for unexported constants - Fix build errors in genesis tools - Add comprehensive migration documentation - Create build-all.sh script for building all tools - Clean up duplicate functions and unused imports Fix remaining imports Update CLI Remove symlink Remove local replace directives Update Update old templates
40 lines
793 B
Go
40 lines
793 B
Go
// Copyright (C) 2025, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
package utils
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
)
|
|
|
|
// FileExists checks if a file exists.
|
|
func FileExists(filename string) bool {
|
|
info, err := os.Stat(filename)
|
|
if os.IsNotExist(err) {
|
|
return false
|
|
}
|
|
return !info.IsDir()
|
|
}
|
|
|
|
// DirExists checks if a directory exists.
|
|
func DirExists(dirName string) bool {
|
|
info, err := os.Stat(dirName)
|
|
if os.IsNotExist(err) {
|
|
return false
|
|
}
|
|
return info.IsDir()
|
|
}
|
|
|
|
// ExpandHome expands ~ symbol to home directory
|
|
func ExpandHome(path string) string {
|
|
if path == "" {
|
|
home, _ := os.UserHomeDir()
|
|
return home
|
|
}
|
|
if len(path) > 0 && path[0] == '~' {
|
|
home, _ := os.UserHomeDir()
|
|
path = filepath.Join(home, path[1:])
|
|
}
|
|
return path
|
|
}
|