filepath

What is the difference between \ and \\ in file path

六眼飞鱼酱① 提交于 2019-12-06 20:23:30
问题 What is the difference between single slash and double slash in file path for Windows operating system such as c:\\Personal\MyFolder\\MyFile.jpg and c:\Personal\MyFolder\MyFile.jpg What if I use the single or double slash because I have tried both for storing images in my code (in webconfig file) and both of them work fine. Is there any difference?? 回答1: Windows ignores double backslashes. So while the second syntax with \ is correct and you should use that one, the first with \\ works too.

getResourceAsStream filepath while running .jar

被刻印的时光 ゝ 提交于 2019-12-06 19:43:38
问题 My code: BufferedInputStream bis = new BufferedInputStream(getClass().getResourceAsStream("playerhit.mp3")); This code works fine when the playerhit.mp3 file is in same package as the MP3.class it is running in. I'm running this as .jar. If though I change the file path to something like /src/data/audio/playerhit.mp3 it doesn't work anymore. Is there anyway to access different filepath than root of the package while running as .jar? 回答1: Take a look at the Javadoc for getResourceAsStream(...)

How to get the full root directory of a ContentManager in XNA 4.0

纵然是瞬间 提交于 2019-12-06 15:27:41
I was wondering if anyone here knows how to find the complete path (from the drive letter onwards) of a ContentManager instance. using this I could create a string with the right number of "..\" to append to the file path when I want to load a file from anywhere else on the computer (eg. from a registry key). So basically I'm asking if there is a way. You may just want to use System.GetFolderPath with one of these locations , most likely Program Files. From there, you can navigate to your application's installation directory. You could also use .Load("\MyFolder\blah") which will load from the

How can I canonicalize Windows file paths in Perl?

拜拜、爱过 提交于 2019-12-06 14:58:16
Update: I can make this a simpler problem to solve: I want to figure out what the correct regex would be to substitute any single occurrence of a back slash with two back slashes. I want to turn this: vlc.plugin.path = C:\Program Files\JekyllV0.9.2\\VLC_1.0.0\\plugins into: vlc.plugin.path = C:\\Program Files\\JekyllV0.9.2\\VLC_1.0.0\\plugins Original question: I want to change the following in a file using a Perl Regex: all occurrences of a single back slash to two back slashes all occurrences of a single forward slash to two back slashes I tried the following: perl" -p -i.orig -e "s#\\#\\\\

How to get the file path of a module from a function executed but not declared in it, in Python?

梦想的初衷 提交于 2019-12-06 14:56:16
问题 If I want the path of the current module, I'll use __file__ . Now let's say I want a function to return that. I can't do: def get_path(): return __file__ Because it will return the path of the module the function has been declared in. I need it to work even if the function is not called at the root of the module but at any level of nesting. 回答1: This is how I would do it: import sys def get_path(): namespace = sys._getframe(1).f_globals # caller's globals return namespace.get('__file__') 回答2:

iPhone App : Where do I put a config file?

放肆的年华 提交于 2019-12-06 13:40:45
问题 In my app, I have a simple ASCII file which stores some config info and other small info which it uses and changes. I want to copy that file to the iPhone with the app. 1) Please tell me where I should put this file (config.txt) in xcode. Should I put it under Resources ? 2) How will I access it in the iPhone ? Can I just use str = [NSString stringWithContentsOfFile:@"config.txt"] or do I have to use a more complete path; if yes, what is that ? 回答1: You should use NSUserDefaults to store user

How to get full size picture and thumbnail from Camera in the same intent

試著忘記壹切 提交于 2019-12-06 13:03:04
问题 I've been needing to get a solution for this problem. I've already searched and tested many solutions from this community but anyone was fit for helping me. I have two activities, the first one takes a picture and sends it to another which has an ImageView to receive that (until here i'm getting problems) and a query to insert the file path in the database (the code which do this last part is well). I guess its better for the View load an Image Low Resolution as a Thumbnail. Therefore, to

how can we know that an Android Application is closed?

做~自己de王妃 提交于 2019-12-06 11:53:45
I am developing an Android Application to download an .mp3 file from server. When downloading is finished the file will be stored in a DIFFRENT EXTENSION (.srt) . and when the user clicked on the play button the file's EXTENSION will be changed back into .mp3 and play And when the user exit's the Application the file will go back to the (.srt) format. Everything works Fine . But now if the user close the application without pressing BackKey the extension will be the same. my code is public void onBackPressed() { new AlertDialog.Builder(this) .setTitle("Really Exit?") .setMessage("Are you sure

Python's trace module and filepaths

南笙酒味 提交于 2019-12-06 09:51:59
I am using python's trace module to trace the execution of some code. I notice that when the execution is later printed, it is printed in the following form (min working example follows below): <filename>(<line number>): <line of code> Is possible to get the full (either absolute or relative) file path instead of just the file name. It makes sense that there would be a flag somewhere in the call to trace.Trace that should allow me to do this, but I don't seem to be able to find any such parameter in the docs. If such a flag does not exist, how would I go about getting the file path? I guess I

How do I get the last part of this filepath?

流过昼夜 提交于 2019-12-06 09:19:26
I have a filepath that follows the following pattern: Some\File\Path\Base\yyyy\MM\dd\HH\mm\Random8.3 I want to extract everything from 2012 and beyond, but the problem is that while the right side is standard the base directory can be different for each record. Here are two examples: C:\Temp\X\2012\08\27\18\35\wy32dm1q.qyt Returns: 2012\08\27\18\35\wy32dm1q.qyt D:\Temp\X\Y\2012\08\27\18\36\tx84uwvr.puq Returns: 2012\08\27\18\36\tx84uwvr.puq Right now I'm grabbing the LastIndexOf(Path.DirectorySeparatorChar) N number of times to get the index of the string right before 2012, then getting the