Files
zeekayandHanzo Dev d096f50cd2 the corporate name is Lux Industries Inc
Lux Partners Limited is not the entity behind this work. Every place the
old name stood — copyright lines, site footers, brand config, legal and
compliance text — now names the company that actually holds it.

lux.fund is the exception and is not renamed to match: that site belongs
to Lux Assets Management LLC, a different company, and it says so.

Two kinds of line were left for a person rather than rewritten. A dated
news item recording that Lux Partners Limited was established in the Isle
of Man is a historical fact, and renaming it would falsify the record. And
a sentence asserting that the company is domiciled in the Isle of Man is a
claim about a jurisdiction, not a name — an Inc or an LLC is not an Isle
of Man company, so swapping the name there would assert something untrue.

Co-authored-by: Hanzo Dev <[email protected]>
2026-08-28 11:02:12 -07:00

60 lines
1.4 KiB
Go

// Copyright (C) 2025, Lux Industries Inc All rights reserved.
// See the file LICENSE for licensing terms.
package fs
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
}
// IsSubPath checks if childPath is inside parentPath.
// Both paths should be absolute paths.
// Returns true if childPath is a subdirectory or file inside parentPath.
func IsSubPath(childPath, parentPath string) bool {
// Clean and normalize paths
child := filepath.Clean(childPath)
parent := filepath.Clean(parentPath)
// Get relative path from parent to child
rel, err := filepath.Rel(parent, child)
if err != nil {
return false
}
// If the relative path starts with "..", child is not inside parent
// Also, if rel equals ".", they're the same path
return rel != "." && len(rel) > 0 && rel[0] != '.'
}