Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development
Squirrel script with error : UnixFilename()
Jenna:
8394 has no such change
I did not look into later revisions.
No time at vthe moment,sorry.
MortenMacFly:
--- Quote from: LETARTARE on October 23, 2012, 09:29:23 am ---But why the change from r8394 ?
--- End quote ---
Inspect the SVN log for a description.
BTW: Is it working with the proposed change or not?
LETARTARE:
YES it works very well as shown MortenMacFly.
Alpha:
Maybe overload instead of default arguments then? ... except this does not compile because squirrel cannot figure out what to bind.
--- Code: ---Index: src/include/globals.h
===================================================================
--- src/include/globals.h (revision 8478)
+++ src/include/globals.h (working copy)
@@ -186,7 +186,8 @@
extern DLLIMPORT wxString MakeUniqueString(const wxString& text, const wxString& separator = DEFAULT_ARRAY_SEP, bool caseSens = true);
extern DLLIMPORT void AppendArray(const wxArrayString& from, wxArrayString& to);
-extern DLLIMPORT wxString UnixFilename(const wxString& filename, wxPathFormat format = wxPATH_NATIVE);
+extern DLLIMPORT wxString UnixFilename(const wxString& filename/*, wxPathFormat format = wxPATH_NATIVE*/);
+extern DLLIMPORT wxString UnixFilename(const wxString& filename, wxPathFormat format/* = wxPATH_NATIVE*/);
extern DLLIMPORT void QuoteStringIfNeeded(wxString& str);
/// Escapes spaces and tabs (NOT quoting the string)
Index: src/sdk/globals.cpp
===================================================================
--- src/sdk/globals.cpp (revision 8478)
+++ src/sdk/globals.cpp (working copy)
@@ -211,6 +211,11 @@
to.Add(from[i]);
}
+wxString UnixFilename(const wxString& filename)
+{
+ return UnixFilename(filename, wxPATH_NATIVE);
+}
+
wxString UnixFilename(const wxString& filename, wxPathFormat format)
{
wxString result = filename;
--- End code ---
MortenMacFly:
--- Quote from: Alpha on October 23, 2012, 11:06:04 pm ---Maybe overload instead of default arguments then?
--- End quote ---
I don't think this is needed. Squirrel does not handle default parameters by design, so as a general rule you always have to provide all parameters for all interfaces. This applies to all squirrel bindings. As we cannot change every method with a default parameter to an overloaded one, developers just have to follow this simple rule:
If there is a default parameter, specify it. Period.
It has been like that since the beginning btw, just as we changed the interface of that methods now you'll need to provide an additional parameter when using it. But this won't hurt.
Navigation
[0] Message Index
[*] Previous page
Go to full version