Get Engram's working directory
()
| 28 | |
| 29 | // Get Engram's working directory |
| 30 | func GetDir() (result string, err error) { |
| 31 | result, err = os.Getwd() |
| 32 | if err != nil { |
| 33 | return |
| 34 | } |
| 35 | |
| 36 | if runtime.GOOS == "darwin" { |
| 37 | switch session.Network { |
| 38 | case NETWORK_MAINNET: |
| 39 | result = filepath.Join(AppPath(), "Contents", "Resources", "mainnet") + string(filepath.Separator) |
| 40 | case NETWORK_SIMULATOR: |
| 41 | result = filepath.Join(AppPath(), "Contents", "Resources", "testnet_simulator") + string(filepath.Separator) |
| 42 | default: |
| 43 | result = filepath.Join(AppPath(), "Contents", "Resources", "testnet") + string(filepath.Separator) |
| 44 | } |
| 45 | } else if runtime.GOOS == "android" { |
| 46 | switch session.Network { |
| 47 | case NETWORK_MAINNET: |
| 48 | result = filepath.Join(AppPath(), "mainnet") + string(filepath.Separator) |
| 49 | case NETWORK_SIMULATOR: |
| 50 | result = filepath.Join(AppPath(), "testnet_simulator") + string(filepath.Separator) |
| 51 | default: |
| 52 | result = filepath.Join(AppPath(), "testnet") + string(filepath.Separator) |
| 53 | } |
| 54 | } else if runtime.GOOS == "ios" { |
| 55 | switch session.Network { |
| 56 | case NETWORK_MAINNET: |
| 57 | result = filepath.Join(AppPath(), "mainnet") + string(filepath.Separator) |
| 58 | case NETWORK_SIMULATOR: |
| 59 | result = filepath.Join(AppPath(), "testnet_simulator") + string(filepath.Separator) |
| 60 | default: |
| 61 | result = filepath.Join(AppPath(), "testnet") + string(filepath.Separator) |
| 62 | } |
| 63 | } else { |
| 64 | switch session.Network { |
| 65 | case NETWORK_MAINNET: |
| 66 | result = filepath.Join(AppPath(), "mainnet") + string(filepath.Separator) |
| 67 | case NETWORK_SIMULATOR: |
| 68 | result = filepath.Join(AppPath(), "testnet_simulator") + string(filepath.Separator) |
| 69 | default: |
| 70 | result = filepath.Join(AppPath(), "testnet") + string(filepath.Separator) |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | return |
| 75 | } |
| 76 | |
| 77 | // Get a datashard's path |
| 78 | func GetShard() (result string, err error) { |