Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
mycard
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
9
Issues
9
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
mycard
Commits
d54f349e
Commit
d54f349e
authored
Jul 29, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test rosetta
parent
4cd077c0
Pipeline
#15019
failed with stages
in 10 minutes and 32 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
8 deletions
+59
-8
app/app.ts
app/app.ts
+8
-3
app/apps.service.ts
app/apps.service.ts
+5
-5
app/utility/arch.ts
app/utility/arch.ts
+46
-0
No files found.
app/app.ts
View file @
d54f349e
...
...
@@ -4,6 +4,7 @@ import * as ini from 'ini';
import
*
as
fs
from
'
fs
'
;
import
*
as
child_process
from
'
child_process
'
;
import
*
as
Mustache
from
'
mustache
'
;
import
{
checkRosetta
}
from
'
./utility/arch
'
;
export
enum
Category
{
game
,
...
...
@@ -342,7 +343,6 @@ export class App {
}
async
spawnApp
(
children
:
App
[],
action_name
=
'
main
'
,
argsTemplate
?:
any
)
{
if
(
this
.
id
===
'
th123
'
)
{
let
th105
=
<
App
>
this
.
references
.
get
(
'
th105
'
);
if
(
th105
.
isInstalled
())
{
...
...
@@ -357,9 +357,14 @@ export class App {
}
const
appCwd
=
(
<
AppLocal
>
this
.
local
).
path
;
const
{
execute
,
args
,
env
,
cwd
}
=
await
this
.
getSpawnAction
(
children
,
action_name
,
null
,
null
,
null
,
argsTemplate
);
const
spawnAction
=
await
this
.
getSpawnAction
(
children
,
action_name
,
null
,
null
,
null
,
argsTemplate
);
if
(
await
checkRosetta
())
{
spawnAction
.
args
=
[
'
-arch
'
,
'
arm64
'
,
spawnAction
.
execute
].
concat
(
spawnAction
.
args
);
spawnAction
.
execute
=
'
arch
'
;
}
const
{
execute
,
args
,
env
,
cwd
}
=
spawnAction
;
console
.
log
(
execute
,
args
,
env
,
cwd
,
appCwd
);
return
child_process
.
spawn
(
execute
,
args
,
{
env
:
env
,
cwd
:
cwd
||
appCwd
});
return
child_process
.
spawn
(
execute
,
args
,
{
env
,
cwd
:
cwd
||
appCwd
});
}
get
isYGOPro
():
boolean
{
...
...
app/apps.service.ts
View file @
d54f349e
import
{
ApplicationRef
,
EventEmitter
,
Injectable
,
NgZone
}
from
'
@angular/core
'
;
import
{
Http
}
from
'
@angular/http
'
;
import
*
as
child_process
from
'
child_process
'
;
import
{
ChildProcess
}
from
'
child_process
'
;
import
{
ChildProcess
,
execFile
,
execFileSync
}
from
'
child_process
'
;
import
*
as
crypto
from
'
crypto
'
;
import
{
remote
}
from
'
electron
'
;
import
*
as
sudo
from
'
electron-sudo
'
;
...
...
@@ -19,8 +19,8 @@ import {LoginService} from './login.service';
import
{
SettingsService
}
from
'
./settings.sevices
'
;
import
{
ComparableSet
}
from
'
./shared/ComparableSet
'
;
import
{
AppsJson
}
from
'
./apps-json-type
'
;
import
*
as
os
from
'
os
'
;
import
Timer
=
NodeJS
.
Timer
;
import
{
getArch
}
from
'
./utility/arch
'
;
const
Logger
=
{
info
:
(...
message
:
any
[])
=>
{
...
...
@@ -657,7 +657,7 @@ export class AppsService {
if
(
!
[
'
zh-CN
'
,
'
en-US
'
,
'
ja-JP
'
].
includes
(
locale
))
{
locale
=
'
en-US
'
;
}
let
updateUrl
=
App
.
updateUrl
(
app
,
process
.
platform
,
locale
,
os
.
a
rch
());
let
updateUrl
=
App
.
updateUrl
(
app
,
process
.
platform
,
locale
,
await
getA
rch
());
let
metalink
=
await
this
.
http
.
post
(
updateUrl
,
changedFiles
).
map
((
response
)
=>
response
.
text
()).
toPromise
();
let
downloadDir
=
path
.
join
(
path
.
dirname
(
app
.
local
!
.
path
),
'
downloading
'
);
let
downloadId
=
await
this
.
downloadService
.
addMetalink
(
metalink
,
downloadDir
);
...
...
@@ -715,7 +715,7 @@ export class AppsService {
if
(
!
[
'
zh-CN
'
,
'
en-US
'
,
'
ja-JP
'
].
includes
(
locale
))
{
locale
=
'
en-US
'
;
}
let
metalinkUrl
=
App
.
downloadUrl
(
_app
,
process
.
platform
,
locale
,
os
.
a
rch
());
let
metalinkUrl
=
App
.
downloadUrl
(
_app
,
process
.
platform
,
locale
,
await
getA
rch
());
_app
.
status
.
status
=
'
downloading
'
;
let
metalink
=
await
this
.
http
.
get
(
metalinkUrl
).
map
((
response
)
=>
response
.
text
()).
toPromise
();
let
downloadId
=
await
this
.
downloadService
.
addMetalink
(
metalink
,
dir
);
...
...
@@ -1123,7 +1123,7 @@ export class AppsService {
locale
=
'
en-US
'
;
}
let
checksumUrl
=
App
.
checksumUrl
(
app
,
process
.
platform
,
locale
,
os
.
a
rch
());
let
checksumUrl
=
App
.
checksumUrl
(
app
,
process
.
platform
,
locale
,
await
getA
rch
());
return
this
.
http
.
get
(
checksumUrl
)
.
map
((
response
)
=>
{
let
map
=
new
Map
<
string
,
string
>
();
...
...
app/utility/arch.ts
0 → 100644
View file @
d54f349e
import
{
promisify
}
from
'
util
'
;
import
{
execFile
}
from
'
child_process
'
;
import
*
as
os
from
'
os
'
;
export
async
function
checkRosetta
()
{
if
(
process
.
platform
!==
'
darwin
'
)
{
return
false
;
}
const
execFileAsync
=
promisify
(
execFile
);
const
sysctlRosettaInfoKey
=
'
sysctl.proc_translated
'
;
let
isRosetta
=
false
;
try
{
console
.
log
(
'
Checking for macOS Rosetta environment
'
);
const
result
=
await
execFileAsync
(
'
sysctl
'
,
[
sysctlRosettaInfoKey
],
{
encoding
:
'
utf8
'
});
isRosetta
=
result
.
stdout
.
includes
(
`
${
sysctlRosettaInfoKey
}
: 1`
);
console
.
log
(
`Checked for macOS Rosetta environment (isRosetta=
${
isRosetta
}
)`
);
}
catch
(
e
)
{
console
.
error
(
`sysctl shell command to check for macOS Rosetta environment failed:
${
e
}
`
);
}
return
isRosetta
;
}
export
async
function
getArch
()
{
const
execFileAsync
=
promisify
(
execFile
);
const
archFromOs
=
os
.
arch
();
if
(
archFromOs
!==
'
x64
'
||
process
.
platform
!==
'
darwin
'
)
{
// not mac or real x64
return
archFromOs
;
}
const
isRosetta
=
await
checkRosetta
();
let
isArm64Mac
=
false
;
try
{
console
.
log
(
'
Checking for arm64 in uname
'
);
const
result
=
await
execFileAsync
(
'
uname
'
,
[
'
-a
'
],
{
encoding
:
'
utf8
'
});
const
isArm
=
result
.
stdout
.
includes
(
'
ARM
'
);
console
.
log
(
`Checked 'uname -a': arm64=
${
isArm
}
`
);
isArm64Mac
=
isArm64Mac
||
isArm
;
}
catch
(
e
)
{
console
.
error
(
`uname shell command to check for arm64 failed:
${
e
}
`
);
}
isArm64Mac
=
isArm64Mac
||
process
.
arch
===
'
arm64
'
||
isRosetta
;
return
isArm64Mac
?
'
arm64
'
:
archFromOs
;
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment