@@ -19,7 +19,12 @@ export enum VersionStatus {
19
19
export class ByondService {
20
20
public latestVersion : Promise < { beta ?: string ; stable : string } > ;
21
21
private lock = new SharedLock ( ) ;
22
- private active : string | null = null ;
22
+
23
+ private _activeVersion : string | null = null ;
24
+ public get activeVersion ( ) {
25
+ return this . _activeVersion ;
26
+ }
27
+
23
28
public deleteVersion = this . lock . wrap ( async ( version : string ) => {
24
29
const installs = await this . getByondFolder ( ) ;
25
30
await installs . removeEntry ( version . toString ( ) ) ;
@@ -28,7 +33,7 @@ export class ByondService {
28
33
'/bin/rm' ,
29
34
`-rf\0/var/lib/byond/${ version } .zip\0/var/lib/byond/${ version } ` ,
30
35
) ;
31
- if ( this . active === version ) this . active = null ;
36
+ if ( this . _activeVersion === version ) this . _activeVersion = null ;
32
37
} ) ;
33
38
34
39
private _versions = new Map < string , VersionStatus > ( ) ;
@@ -58,7 +63,7 @@ export class ByondService {
58
63
`/mnt/host/byond/${ version } .zip` ,
59
64
) ;
60
65
this . _versions . set ( version , VersionStatus . Loaded ) ;
61
- this . active = version ;
66
+ this . _activeVersion = version ;
62
67
} catch ( e ) {
63
68
this . _versions . set ( version , VersionStatus . Fetched ) ;
64
69
await this . commandQueueService . runToCompletion (
@@ -131,7 +136,7 @@ export class ByondService {
131
136
132
137
public useActive < T extends ( path : string | null ) => any > ( fn : T ) {
133
138
this . lock . run ( ( ) =>
134
- fn ( this . active ? `/var/lib/byond/${ this . active } /` : null ) ,
139
+ fn ( this . _activeVersion ? `/var/lib/byond/${ this . _activeVersion } /` : null ) ,
135
140
) ;
136
141
}
137
142
}
0 commit comments