Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-28146] Android: Ti.Filesystem.File rename() should support an absolute path in same directory

GitHub Issuen/a
TypeImprovement
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2020-10-22T22:23:16.000+0000
Affected Version/sn/a
Fix Version/sRelease 9.3.0
ComponentsAndroid
Labelsandroid, engSchedule, file, filesystem, parity
ReporterChristopher Williams
AssigneeJoshua Quick
Created2020-09-18T17:21:23.000+0000
Updated2020-10-22T22:23:16.000+0000

Description

This one shows up in our unit tests for Ti.Filesystem.File.rename. If we attempt to rename a file by passing in an absolute path for the destination (as a sibling of the original file path), the rename fails. See: https://github.com/appcelerator/titanium_mobile/blob/master/tests/Resources/ti.filesystem.file.test.js#L619-L642 I assume the issue is related to the underlying code which constructs the destination file: https://github.com/appcelerator/titanium_mobile/blob/master/android/titanium/src/java/org/appcelerator/titanium/io/TiBaseFile.java#L359-L360

Comments

  1. Joshua Quick 2020-09-18

    [~cwilliams], but should [rename()](https://docs.appcelerator.com/platform/latest/#!/api/Titanium.Filesystem.File-method-rename) accept an absolute path? Our docs for argument newname suggests it should only accept a file *+name+* and not a file *+path+*. And we already have a [move()](https://docs.appcelerator.com/platform/latest/#!/api/Titanium.Filesystem.File-method-move) method with an appropriately named newpath argument. Granted, natively a file rename/move is the same thing, but our Titanium APIs makes a distinction. I don't mind us adding support, but since we correctly follow the docs, I would say this is an "improvement" request and not a "bug".
  2. Joshua Quick 2020-10-01

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/12143
  3. Sohail Saddique 2020-10-08

    FR Passed for this part of the PR.
  4. Lokesh Choudhary 2020-10-22

    Verified the fix with SDK 9.3.0.v20201022111908. Closing.

JSON Source