directory

force SHBrowseForFolder() to show desired directory

给你一囗甜甜゛ 提交于 2019-12-12 11:33:01
问题 I've been searching online and fighting this thing for over an hour and still can't seem to get it to work. Most people seem to be satisfied when they get it this far on forums etc. but mine still doesn't work. I'm trying to force the SHBrowseForFolder() function to start in a folder of my choosing. char current[MAX_PATH]; strcpy(current,"C:\\Users"); char outbuf[MAX_PATH]; BROWSEINFO bis; bis.hwndOwner = NULL; bis.pidlRoot = NULL; bis.pszDisplayName = outbuf; bis.lpszTitle = (LPCSTR)"HERE";

How can I lock a directory in C on a linux machine

旧巷老猫 提交于 2019-12-12 10:46:36
问题 Will flock or lockf work on a directory? I there another way to lock a directory in C on a linux machine? 回答1: Yes, more info about using flock on file/directory can be found here 回答2: You can't open a directory for writing, so that means you can't get a write lock on it. Even if you could, please keep in mind that flock and fcntl and other kinds of POSIX locks are advisory, so they don't actually prevent software that doesn't respect the lock from doing things. Maybe you want to look at

When you update an iOS app, what happens to the Documents folder contents?

岁酱吖の 提交于 2019-12-12 10:44:17
问题 What happens when I update an app that has some files stored in the Documents folder? I need those files to be kept in that folder so the updated app will be able to use them. But it doesn't seem to happen. Is there anyway I can manage to save all my files? 回答1: Your documents will stay where they are - unless the user deletes the app before updating (but that wouldn't be an update..). 来源: https://stackoverflow.com/questions/9311748/when-you-update-an-ios-app-what-happens-to-the-documents

Python os.chdir() doesn't seem to work

懵懂的女人 提交于 2019-12-12 10:43:44
问题 I can't seem to change my directory in python: import os os.getcwd() 'C:\\Users\\Jon\\Folder\\IdbyGenotype' os.chdir(r"C:\Users\Jon\Folder\IdbyGenotype\thisone") os.getcwd() 'C:\\Users\\Jon\\Folder\\IdbyGenotype' Am I missing something? What could be going wrong here? Thanks 回答1: import os os.getcwd() 'C:\\Program Files\\PYTHON' os.chdir('c:\\mytemp') os.getcwd() 'c:\\mytemp' os.chdir(r'c:\') SyntaxError: EOL while scanning string literal os.chdir(r"c:\\") os.getcwd() 'c:\\' I have had

RStudio: unexpected call to `dir.create()` with the first instruction within a project stored on a network drive

徘徊边缘 提交于 2019-12-12 10:35:59
问题 First, apologies for a lack of a reproducible example, but I cannot really provide one as I believe the problem lies within my network settings. Please treat this question as a call for help in debugging the issue... After opening in RStudio a project stored on a network drive and running the very first instruction (being it a package load or even a <- 1 ) I am seeing a really weird output in the console: > a <- 1 Warning message: In dir.create(tempPath, recursive = TRUE) : cannot create dir

Recursive os.listdir? [duplicate]

假如想象 提交于 2019-12-12 10:29:30
问题 This question already has answers here : Python recursive folder read (10 answers) Closed 6 years ago . I'd like to get a list of all files in a directory recursively, with no directories. Say there's a directory ~/files with "a.txt", "b.txt", and a directory "c" with "d.txt" and "e" inside it, and "f.txt" inside e. How would I go about getting a list that looks like ['/home/user/files/a.txt', '/home/user/files/b.txt', '/home/user/files/c/d.txt', '/home/user/files/c/e/f.txt'] ? 回答1: import os

Android: Storing Image into project directory (files)?

…衆ロ難τιáo~ 提交于 2019-12-12 09:41:05
问题 I want to store my Bitmap image into project directory. How can I have access to my project folder or what is the address of my project folder? 回答1: You have to put the images in the res/drawable folder. Then, you can access them by using: R.drawable.name_of_image (for name_of_image.png or name_of_image.jpg ). If you want to access them by their original name, you better save them in the assets folder. Then, you can access them by using the AssetManager : AssetManager am = getResources()

Compress on the fly a directory in tar.gz format using PHP

笑着哭i 提交于 2019-12-12 09:39:03
问题 I want to compress (on the fly) a directory in tar.gz format using PHP. I know it can be done with exec or using this code (using ZIP format) but my host doesn't support exec and hasn't installed the zip extension of PHP. After searching the internet I came across this PHP code: <?php // Computes the unsigned Checksum of a file’s header // to try to ensure valid file // PRIVATE ACCESS FUNCTION function __computeUnsignedChecksum($bytestring) { for($i=0; $i<512; $i++) $unsigned_chksum += ord(

JSoup error 403 when trying to read the contents of a directory on my website

天大地大妈咪最大 提交于 2019-12-12 09:27:36
问题 Exception in thread "main" org.jsoup.HttpStatusException: HTTP error fetching URL. Status=403, URL=(site) at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:449) at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:465) at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:424) at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:178) at org.jsoup.helper.HttpConnection.get(HttpConnection.java:167) at plan.URLReader.main

Getting folder from a path

徘徊边缘 提交于 2019-12-12 09:27:34
问题 Let's say that I have a path as a string (like this one): /ROOT/DIRNAME/FILE.TXT How can I get the parent folder of file.txt (DIRNAME in this case)? 回答1: For a path that should have at least one directory in it: char str[1024]; // arbitrary length. just for this example char *p; strcpy(str, "/ROOT/DIRNAME/FILE.TXT"); // just get the string from somewhere p = strrchr(str, '/'); if (p && p != str+1) { *p = 0; p = strrchr(p-1, '/'); if (p) print("folder : %s\n", p+1); // print folder immediately