Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2226] Filesystem file.rename() is not working on iOS

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:58:28.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.6.0 M05
ComponentsiOS
Labelsdefect, filesystem, ios, ipad, iphone, release-1.6.0, rename
Reporterctredway
AssigneeBlain Hamon
Created2011-04-15T03:14:07.000+0000
Updated2011-04-17T01:58:28.000+0000

Description

Using the following code, file.rename is not working.

var win = Ti.UI.currentWindow;

var f = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory, 'a.txt');

var newFile = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,'newfile.txt');
newFile.write(f.read());

newFile.rename('b.txt');

var renamed = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,'b.txt');
Ti.API.info(renamed.exists());

var file_tf = Titanium.UI.createTextField({

color:'#336699',
height:35,
top:0,
left:0,
width:320,
value:renamed.read()

});

win.add(file_tf);

This is tested against 4.1 and 1.5

Comments

  1. Ralf Pfeiffer 2011-04-15

    This was assigned to Jonathan Sand for his exercise.

    Assigning to Steve to manage the pull from Jonathan.

  2. Stephen Tramer 2011-04-15

    Fixed by commit/merge ff401e1e. Jonathan's solution was definitely more than satisfactory.

    https://github.com/appcelerator/titanium_mobile/commit/ff401e1e4b16a35308b2cb72dd636dae6683c041"> https://github.com/appcelerator/titanium_mobile/commit/ff401e1e4b16...

  3. Thomas Huelbert 2011-04-15

    [INFO] Titanium SDK version: 1.6.0 (01/13/11 08:11 7ca73a3). closed against KS fileSystem example. 4.2.1 ipod touch, 3.1.3 iphone 3g and wfif ipad running 3.2

JSON Source