filepath

How to load files on multiple platforms properly using Java? [duplicate]

[亡魂溺海] 提交于 2019-12-01 22:08:14
问题 This question already has answers here : Platform independent paths in Java (8 answers) Closed 4 months ago . I have a java swing database application which needs to be run on Windows and Linux. My database connection details are stored in a XML file and I load them. This application can load this properties on Linux properly but it is not working on Windows. How do I load files on multiple platforms properly using Java? This is the code: PropertyHandler propertyWriter = new PropertyHandler()

Problem with spaces in a filepath - commandline execution in C#

北城以北 提交于 2019-12-01 21:02:47
I am building a gui for a commandline program. In txtBoxUrls[TextBox] file paths are entered line by line. If the file path contains spaces the program is not working properly. The program is given below. string[] urls = txtBoxUrls.Text.ToString().Split(new char[] { '\n', '\r' }); string s1; string text; foreach (string s in urls) { if (s.Contains(" ")) { s1 = @"""" + s + @""""; text += s1 + " "; } else { text += s + " "; } } System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.StartInfo.CreateNoWindow = true; proc.StartInfo.FileName = @"wk.exe"; proc.StartInfo.Arguments =

C# relative path not start from working directory

南楼画角 提交于 2019-12-01 20:53:31
I have a C# program, it will read a file from a relative path ./report/report1.rdlc , however sometime for a unknown reason it found the file from a completely different place C:\Windows\system32\report\report1.rdlc but the file actually is place in C:\Program Files (x86)\Application1\report\report1.rdlc and the program is inside C:\Program Files (x86)\Application1\ . Any reason the relative path not start from working directory? It does start from the working directory. However, you shouldn't use the working directory, as it can vary if specific IO-Tasks (e.g. sometimes an Open File Dialog or

Save pandas csv to sub-directory

江枫思渺然 提交于 2019-12-01 20:02:08
问题 I am trying to save the output of the following code to a subdirectory: for gp in g: filename = gp[0] + '.csv' print(filename) gp[1].to_csv(filename) I have created the subdirectory first: os.makedirs('MonthlyDataSplit') But I can't find any information as to how to use to_csv to save to a subdirectory rather than the current directory. One approach I was thinking was to use the with "MonthlyDataSplit" open as directory but I can only find the equivalent for opening a file in a subdirectory.

ASP.NET Get physical filepath from URL

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 16:33:58
问题 Is there a way to get the physical filepath from an ASP.NET's URL? Scenerio: I have an app that is on two severs, but it will now be on lots more, and each server puts it in a different physical file path. Right now I'm doing this: //for server 1 if (Request.Url.GetLeftPart(UriPartial.Path).Contains(".com")) { Application["StoreFilesPath"] = "E:\\Data\\rootsite\\f1\\appsite\\Upload\\"; } //for server 2 if (Request.Url.GetLeftPart(UriPartial.Path).Contains(".net")) { Application[

Read file from a folder inside the project directory

醉酒当歌 提交于 2019-12-01 10:57:01
In a JSP project I am reading a file from directory. If i give the full path then i can easily read the file BufferedReader br = new BufferedReader(new FileReader("C:\\ProjectFolderName\\files\\BB.key")); but i don't want to write the full path instead i just want to give the folder name which contains the file, like bellow. BufferedReader br = new BufferedReader(new FileReader("\\files\\BB.key")); How to do this? String currentDirectory = new File("").getAbsolutePath(); System.out.println(currentDirectory); BufferedReader br = new BufferedReader(new FileReader(currentDirectory + "\\files\\BB

Prepending “\\\\?\\” doesn't work for handling long paths

陌路散爱 提交于 2019-12-01 08:46:04
I'm trying to find a workaround for the Windows character limitation that doesn't allow a file to be copied if its name is >= 260 characters. According to this MSDN article , if \\?\ is prepended to the file name, this will circumvent the filename length restriction. I tried this test: string source = "\\\\?\\C:\\Users\\xxxx\\Documents\\Visual Studio 2013\\Projects\\PDFConverterTester\\PDFConverterTester_BatchGUI\\bin\\Debug\\folder1\\a.txt"; string dest= "\\\\?\\C:\\Users\\xxxx\\Documents\\Visual Studio 2013\\Projects\\PDFConverterTester\\PDFConverterTester_BatchGUI\\bin\\Debug\\folder2\\a

Tracing fIle path and line number

吃可爱长大的小学妹 提交于 2019-12-01 08:34:02
I'm using python's trace module to trace some code. When I trace code this way, I can get one of the following two results: Call : tracer = trace.Trace(count=False, trace=True, ignoredirs=[sys.prefix, sys.exec_prefix]) r = tracer.run('run()') tracer.results().write_results(show_missing=True) Result : <filename>(<line number>): <line of code> Call [ citation ]: tracer = trace.Trace(count=False, trace=True, ignoredirs=[sys.prefix, sys.exec_prefix], countfuncs=True) r = tracer.run('run()') tracer.results().write_results(show_missing=True) Result : filename:<filepath>, modulename:<module name>,

Tracing fIle path and line number

强颜欢笑 提交于 2019-12-01 06:37:44
问题 I'm using python's trace module to trace some code. When I trace code this way, I can get one of the following two results: Call : tracer = trace.Trace(count=False, trace=True, ignoredirs=[sys.prefix, sys.exec_prefix]) r = tracer.run('run()') tracer.results().write_results(show_missing=True) Result : <filename>(<line number>): <line of code> Call [citation]: tracer = trace.Trace(count=False, trace=True, ignoredirs=[sys.prefix, sys.exec_prefix], countfuncs=True) r = tracer.run('run()') tracer

Prepending “\\?\” doesn't work for handling long paths

大城市里の小女人 提交于 2019-12-01 06:37:26
问题 I'm trying to find a workaround for the Windows character limitation that doesn't allow a file to be copied if its name is >= 260 characters. According to this MSDN article, if \\?\ is prepended to the file name, this will circumvent the filename length restriction. I tried this test: string source = "\\\\?\\C:\\Users\\xxxx\\Documents\\Visual Studio 2013\\Projects\\PDFConverterTester\\PDFConverterTester_BatchGUI\\bin\\Debug\\folder1\\a.txt"; string dest= "\\\\?\\C:\\Users\\xxxx\\Documents\