标题: 如何获得XUL应用的当前profile,希望这篇英文日志能够帮到惯用英语搜索的人
When we launch our XUL application in multiple profiles mode, we may need to know which profile it works on.
Mozilla provides the interfaces as
nsIToolkitProfileService to get current profile by reading the attribute "
selectedProfile". But in some cases, it doesn't work.
For example, we launch XUL as "
xulrunner.exe -no-remote -profile <profile path or name>
", you can't get the right profile, it always return the default profile configured in file "
//$USERPROFILE\Application Data\$vendor\$appname\Profiles\$random.default
".
I solved this problem by detecting the folder name of the profile root directory. As for the same reason, you can't get the folder from nsIToolkitProfileService. But, we can get current profile root dir, from the File API. For example,
var dirService = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties);
var profDir = dirService.get("ProfD", Components.interfaces.nsIFile);
var profName = profDir.leafName;
Simple, but it works well. ;)
分享到:
相关推荐
including Penetration Tester's Open Source Toolkit (ISBN: 1-5974490210), Stealing the Network: How to Own an Identity (ISBN: 1597490067), InfoSec Career Hacking (ISBN: 1597490113), and OS X for ...
Sample04-Winforms: How to use OpenCVSharp in a WindowsForms application. Sample05: How to use OpenCVSharp in a WPF application. Sample06: How to use VideoCapture and WebCams. Sample07: How to access ...
Sample04-Winforms: How to use OpenCVSharp in a WindowsForms application. Sample05: How to use OpenCVSharp in a WPF application. Sample06: How to use VideoCapture and WebCams. Sample07: How to access ...
Learning to Detect Video SaliencyWith HEVC Features 中文引用格式 英文引用格式 Xu M , Jiang L , Sun X , et al. Learning to Detect Video Saliency With HEVC Features[J]. Image Processing, IEEE ...
Sample04-Winforms: How to use OpenCVSharp in a WindowsForms application. Sample05: How to use OpenCVSharp in a WPF application. Sample06: How to use VideoCapture and WebCams. Sample07: How to access ...
Mean heart rate is a suitable measure to detect tachycardia, bradycardia, and asystole, which are importantmarkers of clinical relevance of seizures. However, in other medical settings, such as the ...
### 学习检测显著物体:图像显著性检测的深度解析 #### 摘要与背景 本文探讨了视觉注意力在图像处理中的应用,通过检测图像中的显著物体来模拟人类视觉系统对特定区域的关注机制。作者将显著物体检测视为一种图像...
Chapter 4, Detecting and Tracking Different Body Parts, shows how to detect and track faces in a live video stream. We will discuss the face detection pipeline and see how we can use it to detect and...
在“SetupMDSolids40.zip_how to research_object detect_object track”这个压缩包中,我们可以找到关于对象检测和跟踪的研究论文。这篇论文详细阐述了如何在IT领域,特别是计算机视觉方面,进行有效的物体识别与...
"CRT detect that the application wrote to memory after end of heap buffer"问题的解决 在编写函数时,常见的一种错误是“CRT detect that the application wrote to memory after end of heap buffer”,这是一...
CVPR2007_Learning_to_detect_a_salient_object论文源代码
The most recent methods for image matching and object recognition are described, and you'll discover how to process video from files or cameras, as well as how to detect and track moving objects....
这个项目“Use YOLOv8 to detect trash”旨在利用YOLOv8在水体图像中定位和识别垃圾,帮助解决环境污染问题,提高环境监测效率。YOLO(You Only Look Once)系列算法以其高效和准确的目标检测能力在计算机视觉领域广...
Chapter 6, Detecting Pedestrians with Support Vector Machines, will explain how to build support vector machines in OpenCV, and how to apply them to detect pedestrians in images. Chapter 7, ...
THe FiberToolbox is a plugin for DREAM.3D that allows the user to extract ellipses from a 2D image. The plugin was primarily developed to extract fibers from a micrograph cross section of a Composite ...