Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19128] Windows: Ti.Filesystem.File.createDirectory will fail if parent directory does not exist

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2015-07-02T19:28:58.000+0000
Affected Version/sRelease 4.1.0
Fix Version/sRelease 4.1.0
ComponentsWindows
Labelsn/a
ReporterFokke Zandbergen
AssigneeChristopher Williams
Created2015-07-01T10:10:06.000+0000
Updated2015-07-07T21:19:45.000+0000

Description

The following code works fine on iOS and Android but will crash the app on Windows, *without showing anything in the logs*:
var win = Ti.UI.createWindow();

var btn = Ti.UI.createButton({
	title: 'Click'
});

btn.addEventListener('click', function (e) {

	var dir1 = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'dir1');
	dir1.createDirectory();

	console.info('Working fine');

	var dir2 = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'sub', 'dir2');
	dir2.createDirectory();

	console.info('Will have crashed on Windows');
});

win.add(btn);
win.open();

Comments

  1. Christopher Williams 2015-07-01

    https://github.com/appcelerator/titanium_mobile_windows/pull/347
  2. Lokesh Choudhary 2015-07-07

    Verified the fix. Closing. Environment: Appc Studio: 4.1.0.201507071122 Ti SDK: 4.1.0.v20150706111546 Ti CLI: 4.0.1 Alloy: 1.6.2 Windows: 8.1 Enterprise 64-bit APPC NPM: 4.1.0-1 APPC CLI: 4.1.0-6 Device: Nokia Lumia 928 - Windows Phone 8.1 Windows emulator : 8.1

JSON Source