g_file_new_for_commandline_arg ()机器翻译

GFile *
g_file_new_for_commandline_arg (const char *arg);

Creates a GFile with the given argument from the command line. The value of arg can be either a URI, an absolute path or a relative path resolved relative to the current working directory. This operation never fails, but the returned object might not support any I/O operation if arg points to a malformed path.

Note that on Windows, this function expects its argument to be in UTF-8 -- not the system code page. This means that you should not use this function with string from argv as it is passed to main(). g_win32_get_command_line() will return a UTF-8 version of the commandline. GApplication also uses UTF-8 but g_application_command_line_create_file_for_arg() may be more useful for you there. It is also always possible to use this function with GOptionContext arguments of type G_OPTION_ARG_FILENAME.

机器翻译:

从命令行使用给定的参数创建一个GFile。 arg的值可以是URI,相对于当前工作目录解析的绝对路径或相对路径。 此操作永远不会失败,但是如果arg指向格式错误的路径,则返回的对象可能不支持任何I / O操作。

请注意,在Windows上,此函数希望其参数位于UTF-8中,而不是系统代码页中。 这意味着您不应将此函数与argv中的字符串一起使用,因为它会传递给main()。 g_win32_get_command_line()将返回命令行的UTF-8版本。 GApplication还使用UTF-8,但在那里g_application_command_line_create_file_for_arg()可能对您更有用。 也始终可以将此函数与G_OPTION_ARG_FILENAME类型的GOptionContext参数一起使用。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值