You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using wxDir and I'm getting this strange error with Exists and GetAllFiles.
C:\Program Files (x86)\ZeroBrane\bin\lua53.exe: C:\USR_2\LUA\WMOQuery\compile.lua:65: wxLua: Expected a 'string' or 'wxString' for parameter 1, but got a 'userdata'.
Function called: 'GetAllFiles(wxDir, string, number)'
01. wxDir::GetAllFiles(string [, string, number]) - static
stack traceback:
[C]: in method 'GetAllFiles'
I reverted my source code to use Open instead of Exists and GetFirst/GetNext instead of GetAllFiles, but wanted to point the issue out.
Below is code failing (actually lines commented out), if can be of help:
localfunctionProcessDirectory(inPathname)
trace.newLine("ProcessDirectory [" ..inPathname.."]")
localdir=wx.wxDir()
ifnotdir:Open(inPathname) thentrace.line("Cannot open directory [" ..inPathname.."]")
returnend-- local _, tFilenames = dir:GetAllFiles("*.json", wx.wxDIR_FILES) -- if tFilenames then-- for _, sFilename in ipairs(tFilenames) do-- ProcessFile(sFilename)-- end-- end-- local _, tDirectories = dir:GetAllFiles("*.*", wx.wxDIR_DIRS)-- if tDirectories then-- for _, sDirectory in ipairs(tDirectories) do-- ProcessDirectory(sDirectory)-- end-- endlocal_, sFilename=dir:GetFirst("*.json", wx.wxDIR_FILES)
whilesFilenameand0<#sFilenamedoProcessFile(inPathname.."\\" ..sFilename)
_, sFilename=dir:GetNext()
endlocal_, sDirectory=dir:GetFirst("*", wx.wxDIR_DIRS)
whilesDirectoryand0<#sDirectorydoProcessDirectory(inPathname.."\\" ..sDirectory)
_, sDirectory=dir:GetNext()
enddir:Close()
end
Thank you
Antonio
The text was updated successfully, but these errors were encountered:
@decuant, both Exists and GetAllFiles are static functions, so you'd need to call them as wxDir.Exists() or dir.Exists() (assuming dir = wx.wxDir()). Notice . instead of :, as the static functions are not methods, so they don't take the object as the first parameter.
Also, for GetAllFiles, it expects the path, the filespec, and the flags, so in your case the call should be dir.GetAllFiles(inPathname, "*.json", wx.wxDIR_FILES). The directory referenced by dir doesn't need to be open for these methods to work, as they take the directory name as the parameter.
Hello,
I'm using wxDir and I'm getting this strange error with Exists and GetAllFiles.
I reverted my source code to use Open instead of Exists and GetFirst/GetNext instead of GetAllFiles, but wanted to point the issue out.
Below is code failing (actually lines commented out), if can be of help:
Thank you
Antonio
The text was updated successfully, but these errors were encountered: