https://github.com/urethramancer/cross
Various cross-platform functionality used in personal projects.
https://github.com/urethramancer/cross
cross-platform files go golang
Last synced: about 1 year ago
JSON representation
Various cross-platform functionality used in personal projects.
- Host: GitHub
- URL: https://github.com/urethramancer/cross
- Owner: Urethramancer
- License: mit
- Created: 2017-05-12T08:24:02.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2019-01-24T00:36:06.000Z (over 7 years ago)
- Last Synced: 2025-02-07T04:13:43.281Z (over 1 year ago)
- Topics: cross-platform, files, go, golang
- Language: Go
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cross
Cross-platform functions I use in some utilities.
## Functions
### SetBasePath()
This is called by init(). It builds the base directory, which in the case of Linux, BSD etc. is just the user's home directory, and on macOS it's `~/Library/Application Support/`.
### ConfigName(filename)
Returns a path suitable for command-line programs, combining the config path and the configuration file.
- On Linux/*BSD this will be the absolute path of `~/./`, and the program name will have spaces removed
- On macOS it returns the absolute path of `~/Library/Application Support//`, with any spaces intact
### ServerConfigName(program, filename)
- Linux/*BSD returns `/etc//`
- macOS simply returns the output from `GetConfigName()`
### Exists(path)
Checks for the existence of a path and return true or false.
### DirExists(path)
Checks for the existence of a directory. A file at the same path would return false.
### FileExists(path)
Checks for the existence of a file. A directory at the same path would return false.