summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormatthieu <matthieu.cneude@gmail.com>2021-04-09 21:50:27 +0200
committermatthieu <matthieu.cneude@gmail.com>2021-04-09 21:50:27 +0200
commit2f92e8cf70f32873b7c77d45e9ae82b4b5ab6226 (patch)
tree3ec3c278830c9897dad6664a2277cce7a5ca44a6
parent38420746e2a9edff396b34528841ad306ab4759b (diff)
Allow $XDG_CONFIG_HOME/devdash directory to be a symlink
-rw-r--r--cmd/list.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/cmd/list.go b/cmd/list.go
index 1149350..fcb9015 100644
--- a/cmd/list.go
+++ b/cmd/list.go
@@ -28,6 +28,20 @@ func listCmd() *cobra.Command {
// TODO to refactor and TEST
func runList() {
+ var err error
+ path := dashPath()
+ d, err := os.Lstat(path)
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ if d.Mode()&os.ModeSymlink == os.ModeSymlink {
+ path, err = os.Readlink(path)
+ if err != nil {
+ log.Fatal(err)
+ }
+ }
+
homeFiles, err := ioutil.ReadDir(dashPath())
if err != nil {
log.Fatal(err)