Skip to content

Port to Windows(MINGW64)#259

Merged
SilverRainZ merged 6 commits into
SrainApp:masterfrom
lifeibiren:port-to-windows
Jul 26, 2020
Merged

Port to Windows(MINGW64)#259
SilverRainZ merged 6 commits into
SrainApp:masterfrom
lifeibiren:port-to-windows

Conversation

@lifeibiren
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Member

@SilverRainZ SilverRainZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tql!

Comment thread .github/workflows/pack-mingw64.sh Outdated
cp -rfv $gdbus $dst_bin/
cp -rfv $mingw64_dlls $dst_bin/
cp -rfv $prefix/lib/gio $dst_lib/
cp -rfv $prefix/lib/gdk-pixbuf-2.0 $dst_lib/
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不太懂 gio 和 gdk-pixbuf 为啥是单独复制的,不能也通过 get_dll 么?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gio / gdk-pixbuf-2.0 是目录,下面的 dll 都是动态加载的,ldd 获取不到,其中还有几个不是动态库的文件

Comment thread src/lib/path.c
if (g_file_test(path, G_FILE_TEST_EXISTS)){
return path;
suffix = g_build_filename("themes", name, NULL);
if (!suffix){
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里应该不会失败?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以,如果不考虑 allocation failure 的话可以省略

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

对于 app 来说,可能考虑了会比较累,不过写了也无妨。

Comment thread src/lib/path.c Outdated
path = srn_find_file_in_prefix(prefix, name);

for (size_t i = 0; i < sizeof(prefix) / sizeof(*prefix) - 1; i++){
g_free(prefix[i]);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以用 g_strfreev

Comment thread src/lib/path.c
path = srn_try_to_find_data_file("srain.cfg");
if (!path){
path = g_build_filename(g_get_user_config_dir(), PACKAGE, "srain.cfg", NULL);
if (!path) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里应该也不需要判断?

Comment thread src/lib/self.c Outdated
@@ -0,0 +1,100 @@
/* Copyright (C) 2020 Fei Li <lifeibiren@gmail.com>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

只在 path.c 内部用的话可以就写 path.c 里?copyright 加一行就好。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

似乎也有道理,之前纠结了一下到底是放在 path.c 中还是单独抽出来,主要纠结的点是“有没有可能未来会在其它地方用到获取可执行文件所在目录的功能”

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个倒是,应该都是 path 相关的,通过 inc/path.h 导出就好?

@lifeibiren
Copy link
Copy Markdown
Contributor Author

看起来我理解错了,g-strfreev 要求存储 char* 的内存是动态分配的

@SilverRainZ
Copy link
Copy Markdown
Member

github 居然不能看 force push 的 diff 么?

@lifeibiren
Copy link
Copy Markdown
Contributor Author

github 居然不能看 force push 的 diff 么?

可以看的,你点 force-pushed 这个连接就是

Copy link
Copy Markdown
Member

@SilverRainZ SilverRainZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SilverRainZ SilverRainZ merged commit f966ce4 into SrainApp:master Jul 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants