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