Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to Windows(MINGW64) #259

Merged
merged 6 commits into from
Jul 26, 2020
Merged

Conversation

lifeibiren
Copy link
Contributor

No description provided.

Copy link
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!

.github/workflows/pack-mingw64.sh Outdated Show resolved Hide resolved
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
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
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 获取不到,其中还有几个不是动态库的文件

if (g_file_test(path, G_FILE_TEST_EXISTS)){
return path;
suffix = g_build_filename("themes", name, NULL);
if (!suffix){
Copy link
Member

Choose a reason for hiding this comment

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

这里应该不会失败?

Copy link
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
Member

Choose a reason for hiding this comment

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

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

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
Member

Choose a reason for hiding this comment

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

可以用 g_strfreev

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
Member

Choose a reason for hiding this comment

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

这里应该也不需要判断?

src/lib/self.c Outdated
@@ -0,0 +1,100 @@
/* Copyright (C) 2020 Fei Li <lifeibiren@gmail.com>
Copy link
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
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
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
Contributor Author

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

@SilverRainZ
Copy link
Member

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

@lifeibiren
Copy link
Contributor Author

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

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

Copy link
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