github.com/richardwilkes/toolbox@v1.121.0/xio/fs/paths/paths_darwin.go (about)

     1  // Copyright (c) 2016-2024 by Richard A. Wilkes. All rights reserved.
     2  //
     3  // This Source Code Form is subject to the terms of the Mozilla Public
     4  // License, version 2.0. If a copy of the MPL was not distributed with
     5  // this file, You can obtain one at http://mozilla.org/MPL/2.0/.
     6  //
     7  // This Source Code Form is "Incompatible With Secondary Licenses", as
     8  // defined by the Mozilla Public License, version 2.0.
     9  
    10  package paths
    11  
    12  import (
    13  	"path/filepath"
    14  
    15  	"github.com/richardwilkes/toolbox/cmdline"
    16  )
    17  
    18  // AppDataDir returns the application data directory.
    19  func AppDataDir() string {
    20  	path := filepath.Join(HomeDir(), "Library", "Application Support")
    21  	if cmdline.AppIdentifier != "" {
    22  		path = filepath.Join(path, cmdline.AppIdentifier)
    23  	}
    24  	return path
    25  }
    26  
    27  // AppLogDir returns the application log directory.
    28  func AppLogDir() string {
    29  	path := filepath.Join(HomeDir(), "Library", "Logs")
    30  	if cmdline.AppIdentifier != "" {
    31  		path = filepath.Join(path, cmdline.AppIdentifier)
    32  	}
    33  	return path
    34  }
    35  
    36  // FontDirs returns the standard font directories, in order of priority.
    37  func FontDirs() []string {
    38  	return []string{filepath.Join(HomeDir(), "Library", "Fonts"), "/Library/Fonts", "/System/Library/Fonts"}
    39  }