private String createDirectoryPath ( String path ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "createDirectoryPath" , "Path=" + path ) ; StringBuilder directoryPath = new StringBuilder ( "" ) ; if ( ( path != null ) && ( path . length ( ) > 0 ) ) { // Defect 287722 // Are we on unix? If so then we need // to make sure we replace the first // slash if present as it will be // removed by the tokenizer. if ( path . charAt ( 0 ) == ' ' ) { directoryPath . append ( "/" ) ; } // Are we UNC format? If so then we need // to make sure we replace the first // two backslashes as they will be // removed by the tokenizer. if ( path . charAt ( 0 ) == ' ' && path . charAt ( 1 ) == ' ' ) { directoryPath . append ( "\\\\" ) ; } final StringTokenizer tokenizer = new StringTokenizer ( path , "\\/" ) ; while ( tokenizer . hasMoreTokens ( ) ) { final String pathChunk = tokenizer . nextToken ( ) ; directoryPath . append ( pathChunk ) ; // Check to see if the directory exists. File test = new File ( directoryPath . toString ( ) ) ; if ( ! test . exists ( ) ) { // Create the directory. test . mkdir ( ) ; } if ( tokenizer . hasMoreTokens ( ) ) { directoryPath . append ( File . separator ) ; } } } String retval = directoryPath . toString ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "createDirectoryPath" , retval ) ; return retval ; }
Checks to see if the supplied path exists and if not creates the directory structure required to store the file store files .