Page 1 of 1

problem with #include directive

Posted: 05 Mar 2010, 10:22
by melojoy
There are difference from 1.6.6 version to past version in the use of #include directive? Or from Win release to Mac realease?

I have to modify .as room extensions that are correct in use in a server with installed 1.6.2 version.

Now in my Mac I have a smartfox 1.6.6 for local test but it doesn't works #include directive; this is the error:

Code: Select all

09:53:06.327 - [ WARNING ] > Failed loading the specified extension script: myExtension.as -> it.gotoandplay.smartfoxserver.exceptions.MalformedIncludeException: Malformed #include directive
09:53:06.508 - [ WARNING ] > Error in extension [ myExtension.as ]: org.mozilla.javascript.UniqueTag (Line number not available)
java.lang.ClassCastException: org.mozilla.javascript.UniqueTag
	at it.gotoandplay.smartfoxserver.extensions.JavascriptExtension.loadScript(JavascriptExtension.java:432)
	at it.gotoandplay.smartfoxserver.extensions.JavascriptExtension.setScriptFile(JavascriptExtension.java:137)
	at it.gotoandplay.smartfoxserver.controllers.ExtensionHandler.loadExtension(ExtensionHandler.java:133)
	at it.gotoandplay.smartfoxserver.controllers.ExtensionHandler.createExtension(ExtensionHandler.java:207)
	at it.gotoandplay.smartfoxserver.controllers.ExtensionHandler.createExtension(ExtensionHandler.java:189)
	at it.gotoandplay.smartfoxserver.controllers.SystemHandler.handleCreateRoom(SystemHandler.java:2386)
	at it.gotoandplay.smartfoxserver.controllers.SystemHandler.processEvent(SystemHandler.java:281)
	at it.gotoandplay.smartfoxserver.controllers.SystemHandler.run(SystemHandler.java:146)
	at java.lang.Thread.run(Thread.java:613)
If I past in "myExtension.as" the code of the .as files included it's work... but I can't do it for all room extensions.

Posted: 05 Mar 2010, 17:12
by Lapo
Maybe characters problems.
Make sure you save your files in UTF-8 with no BOM (ByteOrderMark)
Most editors support that (e.g. Notepad++ on Windows, TextMate and TextWrangler on Mac)

Posted: 08 Mar 2010, 09:35
by melojoy
Hi Lapo,
in version 1.6.2 I don't have this problem: include works.

Saving files (with TextWrangler) UTF-8 with no BOM Classic Mac CR and UTF-8 with no BOM Windows CRLF, include directive doesn't works in SFS 1.6.6.

Posted: 08 Mar 2010, 10:31
by Lapo
Can you send us a bare-bone example that we can test?

Posted: 08 Mar 2010, 15:04
by melojoy
Sorry Lapo,
I didn't apply "UTF-8 with no BOM" in all file included but only in the main file.

Now it's work in 1.6.6 also.

Posted: 09 Mar 2010, 10:23
by melojoy
Hi Lapo,
After using different file configurations, this is the result for Zone and Room Extensions:

OK >> Unicode (UTF-8, no BOM) - Windows (CRLF)
OK >> Unicode (UTF-8, no BOM) - Unix (LF)
FAIL >> Unicode (UTF-8, no BOM) - Classic Mac (CR)
FAIL >> Unicode (UTF-8, no BOM) - Unicode