获取路径的方法

//获取路径的方法
//string location1 = this.GetType().Assembly.Location;
//string location2 = System.AppDomain.CurrentDomain.BaseDirectory;
//string location3 = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
//string location4 = System.IO.Directory.GetCurrentDirectory();
//string location5 = System.Environment.CurrentDirectory;
//string location6 = System.Windows.Forms.Application.StartupPath;
//string location7 = System.Windows.Forms.Application.ExecutablePath;
//string location8 = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;

时间: 2024-08-07 16:35:02

获取路径的方法的相关文章

Java中获取路径的方法_自我分析

就目前的我来说最常用的两种获取路径的方法是  class.getRecource(filename) 和 class.getclassloader.getRecource(filename) 这两者的区别其实很简单就是路径的时候有点不同,这里主要讲两个参数,其他的路径获取,其他的话在根据相对路径逐一查找就行了 class.getRecource(filename): 参数"/" 表示获取根目录; (即我们常用到的bin目录[字节码文件存放的目录] " "  表示获取

GetPathFromUri4kitkat【Android 4.4 kitkat以上及以下根据uri获取路径的方法】

版权声明:本文为博主原创文章,未经博主允许不得转载. 前言 在Android4.4之前和之后,通过Intent调用文件管理器选择文件,获取的文件uri地址形式是不同的. Android6.0 content://com.android.providers.media.documents/document/image%3A593410 Android4.2.2 file:///storage/emulated/0/Pictures/Screenshots/Screenshot_2017-04-17

ASP.NET获取路径的方法

原文:[转载]ASP.NET获取路径的方法 HttpContext.Current.Request.PhysicalPath;    // 获得当前页面的完整物理路径.比如 F:\XFU.NSQS\project\website\Default.aspxHttpContext.Current.Request.PhysicalApplicationPath; // 获得当前程序运行的物理路径比 如F:\XFU.NSQS\project\website\HttpContext.Current.Ser

JavaWeb项目获取路径各种方法。

在jsp和class文件中调用的相对路径不同. 在jsp里,根目录是WebRoot 在class文件中,根目录是WebRoot/WEB-INF/classes 当然你也可以用System.getProperty("user.dir")获取你工程的绝对路径. 另:在Jsp,Servlet,Java中详细获得路径的方法! 1.jsp中取得路径: 以工程名为TEST为例: (1)得到包含工程名的当前页面全路径:request.getRequestURI() 结果:/TEST/test.jsp

Android 4.4 kitkat以上及以下根据uri获取路径的方法

转载请注明出处,谢谢~ 今天我在做视频编辑的时候,遇到了这个问题,前后用了1个小时来发现并解决了这个问题,因为我一直认为是我记错了,后来发现,华为P6用的是Android4.4系统,然后我就恍然了... 首先说说我在做什么,我在弄一个拍摄完视频之后,编辑视频的一个东东,这个东东其实不难,源码里有,你们是不是不敢信?!在android源码android.media.videoeditor中有videoeditor这个类,这个其实就是谷歌写的编辑视频的东东,他底层调用了几个C++写的lib库,这些库

android 获取路径目录方法以及判断目录是否存在,创建目录

Environment 常用方法: * 方法:getDataDirectory()解释:返回 File ,获取 Android 数据目录.* 方法:getDownloadCacheDirectory()解释:返回 File ,获取 Android 下载/缓存内容目录.* 方法:getExternalStorageDirectory()解释:返回 File ,获取外部存储目录即 SDCard* 方法:getExternalStoragePublicDirectory(String type)解释:

idea编译器中maven项目获取路径的方法

资源文件放在哪里? 上 图中的 resources 目录叫资源目录 (main下,与java如果没有请自行创建), 在项目编译后文件会被放到红色的 classes 目录下, 注意如果你的 resources 目录没有上图的那个金色资源目录图标, 请再 idea 上右键该目录选择 Mark directory as - Resources Root, 这样, 在项目编译以后, 你的资源就会放到编译目录下. 如何获得这些文件? 当资源文件被编译到编译目录下以后, 我们可以通过 Class.getRe

java获取路径的方法

package com.zjf; import java.io.File; public class GetPath { public static void getPath() { //方式一 System.out.println(System.getProperty("user.dir")); //方式二 File directory = new File("");//设定为当前文件夹 try{ System.out.println(directory.getC

【转载】ASP.NET获取路径的方法

HttpContext.Current.Request.PhysicalPath;    // 获得当前页面的完整物理路径.比如 F:\XFU.NSQS\project\website\Default.aspxHttpContext.Current.Request.PhysicalApplicationPath; // 获得当前程序运行的物理路径比 如F:\XFU.NSQS\project\website\HttpContext.Current.Server.MapPath(@"\")