filepath

How do I get the file name from a String containing the Absolute file path?

牧云@^-^@ 提交于 2019-12-27 12:50:30
问题 String variable contains a file name, C:\Hello\AnotherFolder\The File Name.PDF . How do I only get the file name The File Name.PDF as a String? I planned to split the string, but that is not the optimal solution. 回答1: just use File.getName() File f = new File("C:\\Hello\\AnotherFolder\\The File Name.PDF"); System.out.println(f.getName()); using String methods : File f = new File("C:\\Hello\\AnotherFolder\\The File Name.PDF"); System.out.println(f.getAbsolutePath().substring(f.getAbsolutePath(

Convert content:// URI to actual path in Android 4.4

空扰寡人 提交于 2019-12-27 10:37:41
问题 I tried a solution (see below) that works fine, except in Android 4.4 the call to startActivityForResult() brings up an activity titled "Open from", which has "Recent", "Images", "Downloads" as well as several apps to pick from. When I choose "Images" and try to resolve the returned content URI (using the code below), the call to cursor.getString() returns null. If I choose the exact same file using the Gallery app, cursor.getString() returns a file path. I've only tested this in API levels

How do I write a file to a nonspecific user's desktop on C? [duplicate]

泪湿孤枕 提交于 2019-12-25 04:41:54
问题 This question already has answers here : Get the user's Desktop folder using Windows API? (2 answers) Closed 5 years ago . I wrote a program and I wanted it to write a file to the Desktop. I figured out how to write it to mine, but I want it to be able to go to anybody's desktop (windows). Is there a way to make the path name more dynamic so it can work on anybody's desktop? This is a sample: void add(void) { FILE *fp; fp = fopen("C:\\Users\\Jones\\Desktop\\test.txt", "w+"); float num1; float

Unexpected Behavior of File picker Blackberry

走远了吗. 提交于 2019-12-25 04:19:31
问题 I am working on File picker from image gallery thats working fine in my 9850 os 7 but when same app if I am deployin to 9780 Os6 Bold device it's not working. public final class MyScreen extends MainScreen implements FieldChangeListener { Bitmap bitmap; ButtonField click; BitmapField bitmapField; public MyScreen() { setTitle("FilePicker Screen"); createGUI(); } private void createGUI() { add(new LabelField("Click to select the image", Field.FIELD_HCENTER)); click=new ButtonField("Click");

Is there any difference between ./ and / in <script> src attribute? [duplicate]

孤者浪人 提交于 2019-12-24 16:52:41
问题 This question already has answers here : What does “./” (dot slash) refer to in terms of an HTML file path location? (10 answers) Closed 8 months ago . Given the following project structure: /root /static script.js page.html This will ' import ' script.js , into the HTML file: <html> <head> <script src="/static/script.js"></script> </head> <body> ... </body> </html> this will, as well: <html> <head> <script src="./static/script.js"></script> </head> <body> ... </body> </html> I am wondering:

Replace “\” with “/” in r [duplicate]

 ̄綄美尐妖づ 提交于 2019-12-24 16:45:57
问题 This question already has answers here : Efficiently convert backslash to forward slash in R (9 answers) Closed last year . I'm trying to replace "\" with "/" or "\\" in R. fp = "C:\users\jordan\Documents\Computer Science\R\miscData.txt" replace(fp, "\", "\\") Output: > fp = "C:\users\jordan\Documents\Computer Science\R\miscData.txt" Error: '\u' used without hex digits in character string starting ""C:\u" Obviously, "\" is an escape character and can't be used this way. Is there a way to

XSLT Document() Function results in Saxon Error/ Attribute-String cant be used as Filepath

可紊 提交于 2019-12-24 11:36:09
问题 Basic Information is I have a Element with an ID I want to use the ID-Attribute within the document()-Function to extract the content of the -element I have two Problems here: 1) my saxon Processor wont resolve any fixed! Filepath I provide within de Document Function -->RESULT: FODC0005 Document has been marked not available: Filepath Question: Why ??? This is my code so far: <xsl:template match="pmentry"><xsl:apply-templates/></xsl:template> <xsl:template match="refdm"><xsl:apply-templates/

Write a text file to a sub-folder

萝らか妹 提交于 2019-12-24 07:03:26
问题 I am trying to write out a text file to: C:\Test folder\output\ , but without putting C:\ in. i.e. This is what I have at the moment, which currently works, but has the C:\ in the beginning. StreamWriter sw = new StreamWriter(@"C:\Test folder\output\test.txt"); I really want to write the file to the output folder, but with out having to have C:\ in the front. I have tried the following, but my program just hangs (doesn't write the file out): (@"\\Test folder\output\test.txt"); (@".\Test

How to open an local pdf using InAppBrowser

半腔热情 提交于 2019-12-24 05:02:29
问题 I have downloaded an pdf file from the server using Transfer Plugin and i am trying to open the file using InAppBrower plugin i am not getting anything. i mean nothing is happening. fileTransfer.download(url, this.file.dataDirectory + file.filename,false,{ headers: { 'authorization': 'bearer xxxx' } }).then((entry) => { console.log('download complete: ' + entry.toURL()); console.log(entry.nativeURL); const browser = this.iab.create(entry.nativeURL, '_system', 'location=yes'); //here the

SplFileObject error failed to open stream: No such file or directory

杀马特。学长 韩版系。学妹 提交于 2019-12-24 04:24:08
问题 i am trying to implement passbook web service in symfony2 and following this passbook bundle and my controller looks like this if ($form->isValid()) { // Create an event ticket $pass = new EventTicket("1234567890", "The Beat Goes On"); $pass->setBackgroundColor('rgb(60, 65, 76)'); $pass->setLogoText('Apple Inc.'); // Create pass structure $structure = new Structure(); // Add primary field $primary = new Field('event', 'The Beat Goes On'); $primary->setLabel('Event'); $structure-