wxFileSystem does not handle paths with `:` symbol (Issue #25482)

10 views
Skip to first unread message

l

unread,
May 31, 2025, 2:31:29 PM5/31/25
to wx-...@googlegroups.com, Subscribed
link2xt created an issue (wxWidgets/wxWidgets#25482)

I was looking at the bugreport for Silverjuke, a music player using wxWidgets, not being able to handle files contaning : in the filename: silverjuke/silverjuke#112

The code uses wxFileSystem to iterate over files in the folder.

I have produced a minimal example described in silverjuke/silverjuke#112 (comment) that reproduces the problem. Reproducing it below:

#include <wx/wx.h>
#include <wx/filesys.h>

#include <iostream>

class MyApp : public wxApp
{
public:
    virtual bool OnInit();
};

IMPLEMENT_APP(MyApp)

bool MyApp::OnInit()
{
    wxString directory = wxT("testdir");

    wxFileSystem fileSystem;

    for (wxString filename = fileSystem.FindFirst(wxT("*"), wxFILE);
         !filename.IsEmpty();
	 filename = fileSystem.FindNext()) {
        std::cerr << "Processing file " << filename << std::endl;

	wxFSFile *fsFile = fileSystem.OpenFile(filename);
	if (fsFile) {
		delete fsFile;
	} else {
            std::cerr << "Failed to open file: " << filename << std::endl;
	}
    }

    return false;
}

I compiled this program with g++ main.cpp $(wx-config --libs --cflags).
I created a folder with files foobar.txt and foobar:baz.txt.

Output of the program shows that it fails to open foobar:baz.txt file:

$ g++ main.cpp $(wx-config --libs --cflags)
$ cd testdir/
$ ../a.out
Processing file file:///home/user/tmp/wxfilesystem/testdir/foobar:baz.txt
Failed to open file: file:///home/user/tmp/wxfilesystem/testdir/foobar:baz.txt
Processing file file:///home/user/tmp/wxfilesystem/testdir/foobar.txt
$ ls -l
total 8
-rw-r--r-- 1 user user 12 2025-05-31 17:59 foobar:baz.txt
-rw-r--r-- 1 user user  6 2025-05-31 17:59 foobar.txt

I have tested this on Arch Linux with packages wxwidgets-common version 3.2.8.1-1 and wxwidgets-gtk3 version 3.2.8.1-1 installed.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/25482@github.com>

VZ

unread,
May 31, 2025, 6:39:00 PM5/31/25
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#25482)

Thanks for the bug report and the test case. I'll try to look into what's exactly going on here and fix it if I can, but if anybody can do it before me and create a PR, it would be most welcome, of course.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/25482/2925889661@github.com>

Reply all
Reply to author
Forward
0 new messages