惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Attack and Defense Labs
Attack and Defense Labs
T
Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
H
Hackread – Cybersecurity News, Data Breaches, AI and More
I
Intezer
C
Cyber Attacks, Cyber Crime and Cyber Security
The Register - Security
The Register - Security
量子位
Security Latest
Security Latest
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
大猫的无限游戏
大猫的无限游戏
小众软件
小众软件
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
C
CXSECURITY Database RSS Feed - CXSecurity.com
MyScale Blog
MyScale Blog
J
Java Code Geeks
Apple Machine Learning Research
Apple Machine Learning Research
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
Spread Privacy
Spread Privacy
Jina AI
Jina AI
博客园 - 【当耐特】
P
Palo Alto Networks Blog
Last Week in AI
Last Week in AI
SecWiki News
SecWiki News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
G
GRAHAM CLULEY
宝玉的分享
宝玉的分享
Hacker News - Newest:
Hacker News - Newest: "LLM"
T
The Blog of Author Tim Ferriss
V
Vulnerabilities – Threatpost
有赞技术团队
有赞技术团队
T
Tor Project blog
H
Hacker News: Front Page
A
Arctic Wolf
NISL@THU
NISL@THU
A
About on SuperTechFans
云风的 BLOG
云风的 BLOG
Engineering at Meta
Engineering at Meta
V
V2EX
N
News and Events Feed by Topic
Webroot Blog
Webroot Blog
Know Your Adversary
Know Your Adversary
P
Privacy International News Feed
I
InfoQ
D
Docker
L
LINUX DO - 最新话题
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
U
Unit 42

博客园 - ю意思я

视频播放的进化(一) 图片同步 WPF初体验 C#实现开关显示器功能 图片裁剪 共享文件夹 w32Time服务(NTP)的一些配置 ShutdownAPI 将文件读取到内存中 在windows server 2003服务器上提供NTP时间同步服务 如何与使用DHCP获取IP地址的设备组网 在VS内添加Web Reference 如何消除锯齿,在图片上画出高质量的文字 如何让Firefox3支持迅雷 获取和设置IP地址 判断字符串是否为IPv4地址 axWindowsMediaPlayer操作 ToFriendlyFileSize Class的设计
关于相对路径匹配的问题
ю意思я · 2008-06-11 · via 博客园 - ю意思я

获取当前进程的绝对路径:

Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);

  获取指定相对路径的绝对路径:

Path.Combine(Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName), ConfigurationManager.AppSettings["FileRoot"]);

  其中"FileRoot"定义在配置文件内:

<add key="FileRoot" value="./" />

  对相对路径的绝对化使用这种组合方法的原因在于,在某些情况下(例如运行在XP下的C-S程序中),如果直接使用相对路径会出现不可预知的路径指向错误。