{ "id": "169782", "key": "TIMOB-25282", "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": "17609", "description": "", "name": "Release 7.0.0", "archived": false, "released": true, "releaseDate": "2017-12-07" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2017-10-09T12:57:27.000+0000", "created": "2017-09-14T16:29:30.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [], "versions": [ { "id": "19870", "description": "", "name": "Release 6.1.2", "archived": false, "released": true, "releaseDate": "2017-08-03" }, { "id": "17609", "description": "", "name": "Release 7.0.0", "archived": false, "released": true, "releaseDate": "2017-12-07" }, { "id": "18414", "description": "", "name": "Release 6.2.0", "archived": false, "released": true, "releaseDate": "2017-09-13" } ], "issuelinks": [], "assignee": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2018-08-06T17:49:12.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": "12642", "name": "Windows", "description": "Windows authoring support" } ], "description": "h5.Description\r\n\r\nCalling Ti.Media.saveToPhotoGallery() throws the following error, running through VS gives more detail and I believe the cause is [to_path here|https://github.com/appcelerator/titanium_mobile_windows/blob/7f4b3efcac026b1b6037b59ad1904556c826db21/Source/Media/src/Media.cpp#L377] is null, so the to convert string call is returning an empty string, which then causes an error in the copy call. I believe this is because the Library folders are virtualized [read here|https://stackoverflow.com/questions/38874259/windows-storage-knownfolders-musiclibrary-path-returns-empty] so they don't have a path, we might need to do something like [this|https://github.com/Microsoft/Windows-universal-samples/blob/6370138b150ca8a34ff86de376ab6408c5587f5d/Samples/FileAccess/cpp/Scenario1_CreateAFileInThePicturesLibrary.xaml.cpp#L31-L48] to first find the folder for a user, then write to that folder\r\n\r\n{code}\r\n[ERROR] ----- Titanium Javascript Runtime Error -----\r\n[ERROR] In app.js: 14,28\r\n[ERROR] Message: Uncaught Error: saveToPhotoGallery: unknown exception\r\n{code}\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow();\r\nvar view = Ti.UI.createView({\r\n backgroundColor: 'red',\r\n width: 400,\r\n height: 400,\r\n borderRadius: 200\r\n});\r\nwin.add(view);\r\nwin.open();\r\nvar file = Ti.Filesystem.getFile('Logo.png')\r\nTi.Media.saveToPhotoGallery(file, {\r\n success: function (e) {\r\n // log.args('Ti.Media', 'Image saved to photo-gallery successfully!');\r\n console.log('image done');\r\n },\r\n error: function (e) {\r\n // log.args('Ti.Media', 'Error saving image to photo-gallery: ' + e.error);\r\n console.log(JSON.stringify(e))\r\n console.log('image ');\r\n }\r\n});\r\n{code}\r\n\r\nh5.Steps to reproduce\r\n\r\n# Add the above to an existing app.js and build for Windows\r\n\r\nh5.Actual\r\n\r\nError thrown\r\n\r\nh5.Expected\r\n\r\nImage should be written to gallery", "attachment": [], "flagged": false, "summary": "Windows: saveToPhotoGallery throws exception", "creator": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "subtasks": [], "reporter": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "environment": "Ti SDK: 6.1.2.GA, 6.2.0.v20170912203804, 7.0.0.v20170906135653", "closedSprints": [ { "id": 951, "state": "closed", "name": "2017 Sprint 20 SDK", "startDate": "2017-09-24T17:50:18.277Z", "endDate": "2017-10-08T17:50:00.000Z", "completeDate": "2017-10-09T20:38:07.840Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "428624", "author": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "body": "https://github.com/appcelerator/titanium_mobile_windows/pull/1127", "updateAuthor": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-10-02T04:08:15.000+0000", "updated": "2017-10-02T04:08:15.000+0000" }, { "id": "440062", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Cleaning up older fixed issues. If this issue should not have been closed as fixed, please reopen.", "updateAuthor": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-08-06T17:49:12.000+0000", "updated": "2018-08-06T17:49:12.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }