Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-19157

Windows: Ti.Filesystem.File.read() fails on device only if file has .js extension

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: Release 4.1.0
    • Fix Version/s: Release 4.1.0
    • Component/s: Windows
    • Labels:
      None
    • Environment:

      SDK 4.1.0.v20150701131146
      Emulator 8-1-1 (works)
      Nokia Lumia

    • Story Points:
      5
    • Sprint:
      2015 Sprint 14 Windows

      Description

      The following example works in the emulator but fails on the .js file on device:

      var win = Ti.UI.createWindow();
      var btn = Ti.UI.createButton({
      	title: 'Click'
      });
       
      btn.addEventListener('click', function (e) {
       
      	try {
      		var txt = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'file.txt');
      		txt.write('Hello world');
      		txt.read();
      	} catch (e) {
      		alert('TXT failed: ' + JSON.stringify(e));
      	}
       
      	try {
      		var js = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'file.js');
      		js.write('Hello world');
      		js.read();
      	} catch (e) {
      		alert('JS failed: ' + JSON.stringify(e));
      	}
       
      	alert('all OK');
      });
       
      win.add(btn);
      win.open();
      

      Error

      {
        "message": "Could not load module: module_path = C:\\Data\\Users\\DefApps\\APPDATA\\Local\\Packages\com.appc.test_339c21w222ff8\\LocalState\\file.js",
        "native_stack": ["JSExportClass<class Titanium::Filesystem::FIle>::CallNamedFunction"],
        "stack": "read@[native code]\n",
        "line": 1
      }
      

      It looks like the .js extension triggers it (but only on device) to use readRequiredModule and then fails. It's the only place where I could find this error.

      In addition the attached screenshots also show another bug, where a caught exception in an event listener still causes another exception raised?

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                cwilliams Christopher Williams
                Reporter:
                fokkezb Fokke Zandbergen
              • Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-20094
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code