获取DirectoryEntry的完整路径

编程入门 行业动态 更新时间:2024-10-25 14:28:54
本文介绍了获取DirectoryEntry的完整路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

有人知道如何在Chrome Packaged应用程序中获取 DirectoryEntry 对象的完整路径,无需任何折叠或其他快捷方式吗?

我在撰写谷歌浏览器打包应用程序。我的应用程序有一个按钮,用户可以使用 chrome.fileSystem API选择目录。当目录选择回到我的应用程序时,它由 DirectoryEntry 对象表示,该对象在 File API 。该对象在控制台中看起来像这样: $ $ $ $ $ c $ DirectoryEntry { filesystem:DOMFileSystem fullPath:/ to_read isDirectory:true isFile:false name:to_read __proto__:DirectoryEntry }

我使用的是Windows,目录的完整路径是 C:\ Users \David\Desktop\to_read

我想要一个函数那可以返回那条路径或其他东西。不幸的是,我发现的最接近的东西是 chrome.fileSystem.getDisplayPath ,但返回以下内容:

〜\Desktop\to_read

来自 getDisplayPath 的返回值对于因为我想获得目录的全名(包括驱动器),所以我可以将它与其他完整目录路径进行比较。

我试过调用 toURL()放在 DirectoryEntry 中,并返回一个空字符串。

关于我的项目:我想以Chrome Packaged App的身份编写iTunes资料库同步器。 iTunes资料库XML文件包含完整路径,如 file:// localhost / D:/David/Music/Bob/Bob%20Album/01%20Bob.mp3 。用户将给我的应用程序访问他的音乐文件夹,我希望能够告诉他是否允许我访问正确的文件夹。

这是目前(2014-01-10)不是Chrome的一个功能,但我已经建议它,他们正在努力:

code.google/p/chromium/issues/detail?id = 322952

Does anyone know how to get the full path of a DirectoryEntry object in a Chrome Packaged App, without any tildes or other shortcuts?

I am writing a Google Chrome Packaged App. My app has a button where a user can choose a directory using chrome.fileSystem API. When the directory choice comes back to my app, it is represented by a DirectoryEntry object, which is defined in the File API. The object looks like this in the console:

DirectoryEntry { filesystem: DOMFileSystem fullPath: "/to_read" isDirectory: true isFile: false name: "to_read" __proto__: DirectoryEntry }

I am using Windows and the full path of the directory is

C:\Users\David\Desktop\to_read

I would like a function that can return that path or something close. Unfortunately, the closest thing I found is chrome.fileSystem.getDisplayPath, but that returns the following:

~\Desktop\to_read

The return value from getDisplayPath is not useful to me, because I want to get the full name of the directory (including the drive) so I can compare it to some other full directory paths I have.

I tried calling toURL() on the DirectoryEntry and it returned an empty string.

A bit about my project: I want to write an iTunes library synchronizer as a Chrome Packaged App. The iTunes library XML file contains full paths like file://localhost/D:/David/Music/Bob/Bob%20Album/01%20Bob.mp3. The user will give my app access to his music folders, and I want to be able to tell if he gave me access to the right folders.

解决方案

This is currently (2014-01-10) not a feature of Chrome, but I have suggested it and they are working on it:

code.google/p/chromium/issues/detail?id=322952

更多推荐

获取DirectoryEntry的完整路径

本文发布于:2023-11-10 02:02:14,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:路径   完整   DirectoryEntry

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!