{ "id": "62858", "key": "TIMOB-2226", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "11238", "name": "Release 1.6.0 M05", "archived": true, "released": true, "releaseDate": "2011-01-17" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T01:58:28.000+0000", "created": "2011-04-15T03:14:07.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "defect", "filesystem", "ios", "ipad", "iphone", "release-1.6.0", "rename" ], "versions": [], "issuelinks": [], "assignee": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-04-17T01:58:28.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "{html}

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

\n

var win = Ti.UI.currentWindow;

\n

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

\n

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

\n

newFile.rename('b.txt');

\n

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

\n

var file_tf = Titanium.UI.createTextField({

\n
\ncolor:'#336699',\nheight:35,\ntop:0,\nleft:0,\nwidth:320,\nvalue:renamed.read()\n
\n

});

\n

win.add(file_tf);

\n

This is tested against 4.1 and 1.5

{html}", "attachment": [], "flagged": false, "summary": "Filesystem file.rename() is not working on iOS", "creator": { "name": "ctredway1", "key": "ctredway1", "displayName": "ctredway", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "ctredway1", "key": "ctredway1", "displayName": "ctredway", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "127879", "author": { "name": "rpfeiffer", "key": "rpfeiffer", "displayName": "Ralf Pfeiffer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

This was assigned to Jonathan Sand for his exercise.

\n

Assigning to Steve to manage the pull from Jonathan.

{html}", "updateAuthor": { "name": "rpfeiffer", "key": "rpfeiffer", "displayName": "Ralf Pfeiffer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:14:08.000+0000", "updated": "2011-04-15T03:14:08.000+0000" }, { "id": "127880", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

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

\n

\nhttps://github.com/appcelerator/titanium_mobile/commit/ff401e1e4b16...

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:14:09.000+0000", "updated": "2011-04-15T03:14:09.000+0000" }, { "id": "127881", "author": { "name": "thomashuelbert", "key": "thomashuelbert", "displayName": "Thomas Huelbert", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

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

{html}", "updateAuthor": { "name": "thomashuelbert", "key": "thomashuelbert", "displayName": "Thomas Huelbert", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:14:09.000+0000", "updated": "2011-04-15T03:14:09.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }