File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 29
29
30
30
package properties
31
31
32
+ import (
33
+ "github.com/arduino/go-paths-helper"
34
+ )
35
+
32
36
// GetBoolean returns true if the map contains the specified key and the value
33
37
// equals to the string "true", in any other case returns false.
34
38
func (m Map ) GetBoolean (key string ) bool {
@@ -45,3 +49,22 @@ func (m Map) SetBoolean(key string, value bool) {
45
49
m [key ] = "false"
46
50
}
47
51
}
52
+
53
+ // GetPath returns a paths.Path object using the map value as path. The function
54
+ // returns nil if the key is not present.
55
+ func (m Map ) GetPath (key string ) * paths.Path {
56
+ value , ok := m [key ]
57
+ if ! ok {
58
+ return nil
59
+ }
60
+ return paths .New (value )
61
+ }
62
+
63
+ // SetPath saves the paths.Path object in the map using the path as value of the map
64
+ func (m Map ) SetPath (key string , value * paths.Path ) {
65
+ if value == nil {
66
+ m [key ] = ""
67
+ } else {
68
+ m [key ] = value .String ()
69
+ }
70
+ }
You can’t perform that action at this time.
0 commit comments