Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20609] Windows: ImageView.image doesn't handle Windows-style path

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2016-03-28T13:25:27.000+0000
Affected Version/sRelease 5.2.0
Fix Version/sRelease 5.3.0
ComponentsWindows
Labelsfilesystem, image, qe-5.3.0, windows_phone
ReporterZakhar Zhuravlev
AssigneeKota Iguchi
Created2016-03-20T09:01:29.000+0000
Updated2016-04-19T23:05:18.000+0000

Description

It's affected 5.2.0. Tested on emulator and on real device (same behaviour) What doing this sample app: copy .png file from Resources folder to dataDirectory and try to set copied image to imageView; *index.js:*
var directory = (Ti.Filesystem.isExternalStoragePresent()) ? Ti.Filesystem.externalStorageDirectory : Ti.Filesystem.applicationDataDirectory;
var fileIndex = 0;
var toFile;

function listFiles() {
    if(OS_WINDOWS) {
    	alert(Ti.Filesystem.getFile(directory).getDirectoryListing());
    } else {
    	console.warn(Ti.Filesystem.getFile(directory).getDirectoryListing());	
    }    
}

function copyFile() {
	fileIndex++;
	var fromFile = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, "test.png");
	toFile = Ti.Filesystem.getFile(directory, '' + fileIndex + '.png');
	toFile.write(fromFile.read());
}
function onImageClick() {
	$.imageView.image = toFile;
        // below another approaches
        // $.imageView.image = toFile.read();
        // $.imageView.image = toFile.nativePath;
        // $.imageView.image = directory + '/' + fileIndex + '.png';
}

$.win.open();
*index.xml:* {noformat}

Comments

  1. Kota Iguchi 2016-03-24

    As far as I can see, this issue is not because of Ti.Filesystem but because Ti.UI.ImageView does not handle image path when it has Windows-style full path such as C:\Data\Users\DefApps\APPDATA\Local\Packages\etc\etc. Tuns out that Image.image doesn't handle Ti.File and Ti.Blob object too. I've changed title of this ticket.
  2. Kota Iguchi 2016-03-24

    https://github.com/appcelerator/titanium_mobile_windows/pull/593
  3. Kota Iguchi 2016-03-27

    Broke down Ti.Blob & Ti.Filesystem.File support into (TIMOB-23115). Now TIMOB-20609 (this ticket) is but fix for file path with string.
  4. Kota Iguchi 2016-03-28

    https://github.com/appcelerator/titanium_mobile_windows/pull/593 Fix bugs when you use ImageView.image with Windows path string such as toFile.nativePath. Test cases: [ti.ui.imageview.test.js](https://github.com/infosia/titanium_mobile_windows/blob/TIMOB-20609/Examples/NMocha/src/Assets/ti.ui.imageview.test.js#L40) Note that we split File and Blob support into TIMOB-23115.
  5. Josh Longton 2016-04-19

JSON Source