The solution is to use
hierarchical upload/download directories.
To do this, include the line
".html_text("
This causes BOINC to use hierarchical upload/download directories. Each directory will have a set of 1024 subdirectories, named 0 to 3ff. Files are hashed (based on their filename) into these directories.
The hierarchy is used for input and output files only. Executables and other application version files are in the top level of the download directory.
This affects your project-specific code in a couple of places. First, your work generator must put input files in the right directory before calling create_work(). To do this, it can use the function ".html_text(" int dir_hier_path( const char* filename, const char* root, int fanout, bool newhash, char* result, bool make_directory_if_needed ); ")." This takes a name of the input file and the absolute path of the root of the download hierarchy (typically the download_dir element from config.xml) and returns the absolute path of the file in the hierarchy. For new projects, newhash should be set to true. This argument may eventually disappear: it was added to work around a poor initial choice of hashing function for determining fanout directory names. Generally make_directory_if_needed should also be set to true: this creates a fanout directory if needed to accomodate a particular file. Note: you may see this function occuring at times with the final argument missing. In this case C++ defaults to setting make_directory_if_needed==false. [DAVID: PLEASE CONFIRM!]
Secondly, your validator and assimilator should call ".html_text(" int get_output_file_path(RESULT const& result, string& path); ")." to get the paths of output files in the hiearchy. If your application has multiple output files, you'll need to generalize this function.
A couple of utility programs are available:
".html_text("
dir_hier_move src_dir dst_dir fanout
dir_hier_path filename
")."
dir_hier_move
moves all files from src_dir (flat)
into dst_dir (hierarchical with the given fanout).
dir_hier_path
, given a filename,
prints the full pathname of that file in the hierarchy.
If you are operating a project with flat directories, you can transition to a hierarchy as follows: