How to open a file which includes in Chrome extension by C/C++?

前端 未结 2 958
陌清茗
陌清茗 2021-01-17 04:24

I\'m trying to open a file to parse, say \"config.txt\", in my Chrome extension.

By Javascript it will be fairly easy. For example: chrome.extension.getURL(\'c

2条回答
  •  清酒与你
    2021-01-17 04:48

    There are two ways you could address this; the first is to simply use javascript to get the path and then pass it into the plugin in a method call.

    The second is to get the path to the plugin .dll file and then calculate the location of config.txt relative to that as explained on the website.

    I suppose the other option would be to try to use:

    m_host->getDOMWindow()->getNode("chrome")->getNode("extension")->getNode("getURL")->callMethod("", FB::variant_list_of("config.txt");
    

    I don't know if that would actually work or not; I haven't tried it, and I may have even mistyped some of the function calls, but it might be worth a try.

提交回复
热议问题