There was an error while loading. Please reload this page.
1 parent 679e9c4 commit fbf83efCopy full SHA for fbf83ef
10 files changed
.github/workflows/windows-version-build.yml
@@ -53,10 +53,14 @@ jobs:
53
54
- name: Build Go helper with build-win.ps1
55
run: |
56
+ go install github.com/tc-hib/go-winres@latest
57
+ $GOBIN = $(go env GOPATH) + "\bin"
58
+ $env:PATH = "$GOBIN;$env:PATH"
59
cd "$env:GITHUB_WORKSPACE/src/helper-go"
60
go clean -modcache
61
go mod download
62
go mod tidy
63
+ go-winres make
64
# 使用 PowerShell 脚本构建
65
.\build-win.ps1
66
build/macos.build.yml
@@ -1 +1 @@
1
-version: 10
+version: 11
build/windows.build.yml
-version: 16
+version: 17
configs/electron-builder.linux.ts
@@ -15,7 +15,7 @@ const desktop: any = {
15
const conf: Configuration = {
16
productName: 'FlyEnv',
17
executableName: 'FlyEnv',
18
- buildVersion: '4.13.0',
+ buildVersion: '4.13.1',
19
electronVersion: '35.7.5',
20
appId: 'com.xpf0000.flyenv',
21
asar: true,
configs/electron-builder.ts
@@ -19,7 +19,7 @@ const currentArch = process.arch === 'arm64' ? 'arm64' : 'x64'
22
23
24
appId: 'phpstudy.xpfme.com',
25
@@ -69,7 +69,7 @@ const conf: Configuration = {
69
extendInfo: {
70
'Icon file': 'icon.icns',
71
CFBundleDisplayName: 'FlyEnv',
72
- CFBundleExecutable: 'PhpWebStudy'
+ CFBundleExecutable: 'FlyEnv'
73
},
74
type: 'distribution',
75
darkModeSupport: true,
configs/electron-builder.win.ts
@@ -3,8 +3,8 @@ import AfterSign from '../build/afterSign'
3
4
5
6
- executableName: 'PhpWebStudy',
7
+ executableName: 'FlyEnv',
8
9
10
@@ -14,7 +14,6 @@ const conf: Configuration = {
14
files: [
'dist/electron/**/*',
'dist/render/**/*',
- 'static/sh/Windows/flyenv-helper-init.ps1',
'!**/node_modules/*/{CHANGELOG.md,README.md,README,readme.md,readme,LICENSE}',
'!**/node_modules/*/{test,__tests__,tests,powered-test,example,examples}',
'!**/node_modules/*.d.ts',
@@ -31,7 +30,7 @@ const conf: Configuration = {
31
30
to: 'app.asar.unpacked/node_modules/helper/flyenv-helper.exe'
32
}
33
],
34
- signExts: ['flyenv-helper.exe', 'flyenv-helper-init.ps1'],
+ signExts: ['flyenv-helper.exe'],
35
icon: 'build/icon.ico',
36
target: [
37
{
package.json
@@ -1,6 +1,6 @@
2
- "name": "PhpWebStudy",
- "version": "4.13.0",
+ "name": "FlyEnv",
+ "version": "4.13.1",
"description": "All-In-One Full-Stack Environment Management Tool",
"author": {
"name": "Pengfei Xu",
src/helper-go/build-win.ps1
@@ -70,7 +70,7 @@ $env:CGO_ENABLED = "0"
$buildOutput = Join-Path -Path $BUILD_DIR -ChildPath $OUTPUT_FILENAME
$buildArgs = @(
"build",
- "-ldflags=`"-H windowsgui`"",
+ "-ldflags=`"-s -w -H windowsgui`"",
"-o",
$buildOutput,
76
$MAIN_PACKAGE
src/helper-go/winres.json
@@ -0,0 +1,13 @@
+{
+ "RT_VERSION": {
+ "vars": {
+ "FileDescription": "FlyEnv Helper - System Service Manager",
+ "ProductName": "FlyEnv",
+ "CompanyName": "FlyEnv Project",
+ "OriginalFilename": "flyenv-helper.exe",
+ "LegalCopyright": "Copyright © Pengfei Xu",
+ "FileVersion": "1.0.0.8",
+ "ProductVersion": "4.13.0"
11
+ }
12
13
+}
src/main/index.ts
@@ -1,9 +1,42 @@
+import { app } from 'electron'
import path from 'path'
import Launcher from './Launcher'
import { fileURLToPath } from 'node:url'
import { dirname } from 'node:path'
+import { existsSync } from 'node:fs'
+import fs from 'fs-extra' // 建议使用 fs-extra 处理文件夹复制
+
const __dirname = dirname(fileURLToPath(import.meta.url))
+const appData = app.getPath('appData')
+const oldPath = path.join(appData, 'PhpWebStudy')
+const nowPath = path.join(appData, 'FlyEnv')
+/**
+ * 迁移逻辑:如果新文件夹不存在且旧文件夹存在,则进行同步复制
+ */
+try {
+ if (!existsSync(nowPath) && existsSync(oldPath)) {
+ console.log('Detected legacy data, migrating from PhpWebStudy to FlyEnv...')
+ // 使用 copySync 同步复制整个目录,确保在应用完全启动前数据到位
+ fs.copySync(oldPath, nowPath, {
+ overwrite: false,
+ errorOnExist: true
+ })
26
+ console.log('Migration successful.')
27
28
+} catch (err) {
29
+ console.error('Data migration failed: ', err)
+// 重要:强制将当前的 userData 指向 nowPath
+// 这样无论 package.json 里的 name 是什么,都会使用 FlyEnv 目录
+app.setPath('userData', nowPath)
+app.setPath('sessionData', nowPath)
+// 打印确认最终路径
38
+console.log('Final userData path: ', app.getPath('userData'))
39
40
global.__static = path.resolve(__dirname, 'static/').replace(/\\/g, '\\\\')
41
global.launcher = new Launcher()
42
0 commit comments