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

Filesystem rename and move broken due to conversion to file urls

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: Release 1.7.0
    • Fix Version/s: Sprint 2011-20
    • Component/s: iOS
    • Labels:
      None
    • Environment:

      ios4.3 SDK, sim and device.

      Description

      Test code:
      {{
      var f = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory, 'test.txt');
      Ti.API.info('file = ' + f);
      var contents = f.read();
      Ti.API.info("contents blob object = "+contents);
      Ti.API.info('contents = ' + contents.text);
      Ti.API.info('mime type = ' + contents.mimeType);
      Ti.API.info('nativePath = ' + f.nativePath);
      Ti.API.info('exists = ' + f.exists());
      Ti.API.info('size = ' + f.size);
      Ti.API.info('readonly = ' + f.readonly);
      Ti.API.info('symbolicLink = ' + f.symbolicLink);
      Ti.API.info('executable = ' + f.executable);
      Ti.API.info('hidden = ' + f.hidden);
      Ti.API.info('writeable = ' + f.writeable);
      Ti.API.info('name = ' + f.name);
      Ti.API.info('extension = ' + f.extension());
      Ti.API.info('resolve = ' + f.resolve());
      Ti.API.info('created = ' + String(new Date(f.createTimestamp()))); // #2085 test

      var dir = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory);
      Ti.API.info('directoryListing = ' + dir.getDirectoryListing());
      Ti.API.info('getParent = ' + dir.getParent());
      Ti.API.info('spaceAvailable = ' + dir.spaceAvailable());

      var newDir = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory+'/mydir');
      Ti.API.info("Creafffted mydir: " + newDir.createDirectory());
      Ti.API.info('newdir ' + newDir.nativePath);
      var newFile = Titanium.Filesystem.getFile(newDir.nativePath,'newfile.txt');
      newFile.write(f.read());
      Ti.API.info('directoryListing for newDir = ' + newDir.getDirectoryListing());
      Ti.API.info("newfile.txt created: " + String(new Date(newFile.createTimestamp())));
      Ti.API.info("newfile.txt modified: " + String(new Date(newFile.modificationTimestamp())));
      Ti.API.info("newfile.txt renamed as b.txt: " + newFile.rename('b.txt'));
      var renamedFile = Titanium.Filesystem.getFile(newDir.nativePath, 'b.txt');
      Ti.API.info('check to see if renamedFile is TiFilesystemFile object: '+renamedFile);

      // try moving the file to the data directory
      var moveNewFile = renamedFile.move(Titanium.Filesystem.applicationDataDirectory+'/b.txt');
      Ti.API.info('move file result (should be true): '+moveNewFile);
      }}

        Attachments

          Activity

            People

            • Assignee:
              stephentramer Stephen Tramer
              Reporter:
              blainhamon Blain Hamon
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

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

                  Git Integration