directory-structure

cmake glob include while preserving directory structure

佐手、 提交于 2019-12-21 03:33:25
问题 I'm new to cmake and I'm trying to install .hpp files while preserving directory structure. So far I have FILE(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp" "${CMAKE_CURRENT_SOURCE_DIR}/include/MyLib/*.hpp" "${CMAKE_CURRENT_SOURCE_DIR}/include/MyLib/detail/*.hpp" install (FILES ${files} DESTINATION include) All the files get found but the directory hierarchy is flattened. FWIW The bjam command I'm trying to emulate is install headers : ../include/EnsembleLearning.hpp [ glob ..

md5 all files in a directory tree

时光毁灭记忆、已成空白 提交于 2019-12-20 17:49:12
问题 I have a a directory with a structure like so: . ├── Test.txt ├── Test1 │ ├── Test1.txt │ ├── Test1_copy.txt │ └── Test1a │ ├── Test1a.txt │ └── Test1a_copy.txt └── Test2 ├── Test2.txt ├── Test2_copy.txt └── Test2a ├── Test2a.txt └── Test2a_copy.txt I would like to create a bash script that makes a md5 checksum of every file in this directory. I want to be able to type the script name in the CLI and then the path to the directory I want to hash and have it work. I'm sure there are many ways

Python relative-import script two levels up

ぐ巨炮叔叔 提交于 2019-12-20 10:23:31
问题 I've been struggling with imports in my package for the last hour. I've got a directory structure like so: main_package | | __init__.py | folder_1 | | __init__.py | | folder_2 | | | __init__.py | | | script_a.py | | | script_b.py | | folder_3 | | __init__.py | | script_c.py I want to access code in script_b.py as well as code from script_c.py from script_a.py . How can I do this? If I put a simple import script_b inside script_a.py , when I run from main_package.folder_1.folder_2 import

Python relative-import script two levels up

流过昼夜 提交于 2019-12-20 10:20:03
问题 I've been struggling with imports in my package for the last hour. I've got a directory structure like so: main_package | | __init__.py | folder_1 | | __init__.py | | folder_2 | | | __init__.py | | | script_a.py | | | script_b.py | | folder_3 | | __init__.py | | script_c.py I want to access code in script_b.py as well as code from script_c.py from script_a.py . How can I do this? If I put a simple import script_b inside script_a.py , when I run from main_package.folder_1.folder_2 import

Yield in a recursive function

感情迁移 提交于 2019-12-20 08:22:56
问题 I am trying to do something to all the files under a given path. I don't want to collect all the file names beforehand then do something with them, so I tried this: import os import stat def explore(p): s = '' list = os.listdir(p) for a in list: path = p + '/' + a stat_info = os.lstat(path ) if stat.S_ISDIR(stat_info.st_mode): explore(path) else: yield path if __name__ == "__main__": for x in explore('.'): print '-->', x But this code skips over directories when it hits them, instead of

Organizing directory structure of an API centric web application

百般思念 提交于 2019-12-20 05:25:26
问题 Below is a directory structure for a PHP application I have pieced together from examples that provides accessibility via a central (api.php) entry point, no namespaces yet, and class names are identical to file names . I have separated directories into authentication (has login scripts to process log in, logout, create user config (site wide settings, database settings) controllers (holds class files, with member functions that call specific data method) models (makes simple CRUD operation

How to create directories specified by a mapper in Ant

三世轮回 提交于 2019-12-20 03:49:39
问题 Given a fileset <fileset id="myFiles" dir="."> <include name="**/*.file"/> </fileset> How do I create a sub-directory at each file in the set, named after the filename without the extension? For example, given the files folderA/X.file and folderA/folderB/Y.file, I want to create the directories folderA/X and folderA/folderB/Y 回答1: The ant touch task supports creating files, parent dirs and filename mapping, so can be used to achieve this: <target name="mkdirs"> <touch mkdirs="true"> <fileset

Python: Check if a directory is an alias

夙愿已清 提交于 2019-12-20 03:16:55
问题 Does python have a simple function for checking if a directory is an actual directory or if it's just an alias to another directory? I'm trying to list all files/folders in a directory but because of these alias folders, I'm getting a lost of stuff that looks like this: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bundle/Home/bundle/Home/bundle/Home/bundle/Home/bundle/Home/bundle/Home/bundle/Home/bundle/Home/bundle/Home/bundle/Home/bundle I know I can write a function that

What is the correct way to use the stat() function to test if a DIRENT is a directory or a file?

£可爱£侵袭症+ 提交于 2019-12-20 01:39:12
问题 I'm having some trouble with the 'if(S_IFDIR(stbuf.st_mode))' line. Is this the correct way to test for a directory to recurse into? The function at the moment seems to do it right for 1 or 2 loops and then fails and segmentation faults. I've tried the following and probably more as the condition. S_ISDIR(st_mode) ((st_mode & ST_IFMT) == S_IFDIR) S_IFDIR(stbuf.st_mode) I've included the whole function because I'm concerned the problem might be elsewhere. void getFolderContents(char *source,

Keeping directory structure when creating frameworks in xcode

安稳与你 提交于 2019-12-19 05:14:58
问题 I'm trying to create a framework in Xcode and have successfully done so, but as it turns out, Xcode flattens the directory structure of when copying headers in the Copy Headers build phase. I've tried adding the files as Folder References instead of the groups, but then it won't even recognize the header-files as header files! So, how can I tell Xcode to keep the directory structure when copying the header files to my .framework-bundle? 回答1: Use Copy Files instead of Copy Headers in the Build