windows phone 8 Cordova - placing a file in a different path

流过昼夜 提交于 2020-01-06 17:42:28

问题


I am very new to VisualStudio and porting a cordova/phonegap application from android to windows phone 8.

So I created a new project using createTemplates.bat and imported it in my VS2012 Express.

The core result is one www folder containing img/css/js and index.html; it works fine and I manage to launch it and deploy on my device.

Because the application is quite big, I want to create a new sub-folder call subfold (under img), and placing picture.jpg in there so in solutionExplorer I have img/subfold/picture.jpg (even if it is hidden); but I cannot use picture.jpg while I can use it if it's in img.

  • How can I do that? Is it a limit of VS 2012?

I am 100% sure that I use the proper path. Another notable thing is that in SolutionExplorer View, the subfolder and its content are disabled (look at "attivita" below) and Build Action property does not exist while it exists and set to 'Content' if the image is inside img


回答1:


From the screenshot I can see that the icon for the folder is ghosted out, this means that the folder exists in the file directory, but isn't included in the Visual Studio solution. You can right-click on the folder and choose the option to include the folder in the solution. You may also need to add each of the items in the folders to the solution via the Solution Explorer.




回答2:


you can use the absolute path for Windows Phone and not the www folder, this is what i have write for Android Windows Phone8 and iPhone

if( /Android|BlackBerry Mini/i.test(navigator.userAgent) ) {
    //android absolute path
    path = cordova.file.applicationStorageDirectory;
} else if (isWindowsPhone) {
    //windows phone absolute path
    path = "//";
} else {
    //iphone absolute path
    path = cordova.file.documentsDirectory;
}


来源:https://stackoverflow.com/questions/25621952/windows-phone-8-cordova-placing-a-file-in-a-different-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!