File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -825,13 +825,18 @@ func ParseDuration(s string) (time.Duration, error) {
825
825
// regardless of storage configuration, since each instance is intended to
826
826
// have its own unique ID.
827
827
func InstanceID () (uuid.UUID , error ) {
828
- uuidFilePath := filepath .Join (AppDataDir (), "instance.uuid" )
828
+ appDataDir := AppDataDir ()
829
+ uuidFilePath := filepath .Join (appDataDir , "instance.uuid" )
829
830
uuidFileBytes , err := os .ReadFile (uuidFilePath )
830
831
if os .IsNotExist (err ) {
831
832
uuid , err := uuid .NewRandom ()
832
833
if err != nil {
833
834
return uuid , err
834
835
}
836
+ err = os .MkdirAll (appDataDir , 0o600 )
837
+ if err != nil {
838
+ return uuid , err
839
+ }
835
840
err = os .WriteFile (uuidFilePath , []byte (uuid .String ()), 0o600 )
836
841
return uuid , err
837
842
} else if err != nil {
You can’t perform that action at this time.
0 commit comments