简体   繁体   English

在 wxWidgets 应用程序中导航文件夹

[英]Navigating folders in a wxWidgets application

I need to navigate between folders in my wx app.我需要在我的 wx 应用程序中的文件夹之间导航。 I was using the std::filesystem::path, which was pretty handy.我使用的是 std::filesystem::path,它非常方便。 Using overloaded operators like + and \ was very good and practical, but the constant conversion to std::string and wxString was verbose.使用像 + 和 \ 这样的重载运算符非常好且实用,但是到 std::string 和 wxString 的常量转换很冗长。

So, is there a way to do something similar in wxWidgets?那么,有没有办法在 wxWidgets 中做类似的事情? In my app, I was using a wxString like that:在我的应用程序中,我使用的是这样的 wxString:

wxString path = SomeOtherWxStringPath + "\\\\" + "image.png";

but this doesn't seem right.但这似乎不对。 What do you suggest, as my application would be deployed in Windows and Linux.你有什么建议,因为我的应用程序将部署在 Windows 和 Linux 中。

My recommendation would be to use std::fs and either utf8_string() or ToStdWstring() for simple conversion from wxString to std::[w]string respectively (the conversion in the other direction is implicit by default).我的建议是分别使用std::fsutf8_string()ToStdWstring()进行从wxStringstd::[w]string的简单转换(默认情况下,另一个方向的转换是隐式的)。

But there is also wxFileName in wxWidgets if you really want to use it.但是如果你真的想使用它,wxWidgets 中也有wxFileName

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM