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

Anvil: issues using Ti.Filesystem.getFile

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Low
    • Resolution: Won't Fix
    • Affects Version/s: Release 3.2.1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Environment:

      Anvil
      TiSDK 3.2.1

      Description

      Problem description

      Using Anvil for SyncServer testing, an issue is surfacing when using Ti.Filesystem.getFile for checking folder.

      Attached sample code run manually on device works as expected.

      See lines 153 to 170 of the attached sample code 'app.js':

       function copyfiles(){
              var srcDataDir = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, "myfiles");
              var destDataDir = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, "myfiles");
              destDataDir.createDirectory();
              var files = srcDataDir.getDirectoryListing();
              var qty = files.length;
              Ti.API.info('#### qty: ' + JSON.stringify(qty));
              for(var i = 0; i < (qty-1); i++) {
                  var srcFile = Ti.Filesystem.getFile(srcDataDir.nativePath, files[i]);
                  var destFile = Ti.Filesystem.getFile(destDataDir.nativePath, files[i]);
                  destFile.write(srcFile.read());
       
                  if (!destFile.exists()) {
                  	 alert(destFile.nativePath);
                  };
              }
          }
      

      When run on device, it works as expected (destFile.exists() returns true).

      However, running the same code on Anvil and adding a valueOf check:

      valueOf(testRun,destFile.exists()).shouldBeTrue();
      

      is returning false, thus an error.

      'externalfilesync.js' file attached is the Anvil test sample - see 'function copyfiles()' line 214.

        Attachments

          Activity

            People

            • Assignee:
              emerriman Eric Merriman
              Reporter:
              fcasali Federico Casali
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

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

                  Git Integration