-
Notifications
You must be signed in to change notification settings - Fork 5
/
os.go
51 lines (39 loc) · 1.13 KB
/
os.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* For license and copyright information please see LEGAL file in repository */
package dos
import (
goos "os"
"runtime"
"../../file"
"../../log"
"../../protocol"
)
// OS implements protocol.OperatingSystem
var OS os
type os struct {
AppID [32]byte // Hash of domain act as Application ID too
State protocol.ApplicationState
StateChannel chan protocol.ApplicationState
appFileURI file.URI // Just fill in old type OS like linux, windows, ...
localFileDirectory FileDirectory
localObjectDirectory protocol.ObjectDirectory
netTransMux
}
// Init method use to auto initialize App object with default data.
func init() {
log.Info("Application Run on ", runtime.GOOS, " OS")
// Indicate repoLocation
var ex, err = goos.Executable()
if err != nil {
log.Fatal(err)
}
log.Info("Application binary file location is", ex)
OS.appFileURI.Init(ex)
goos.Chdir(ex)
OS.localFileDirectory.init("/") // TODO::: add more data like domain
// Register data-structures
// persiaos.StorageRegisterStructure(d.ID)
}
// Shutdown use to graceful stop os
func (os *os) Shutdown() {
// os.localFileDirectory.Save()
}