\hypertarget{os__dirpath_8h}{\section{opal/util/os\+\_\+dirpath.h File Reference}
\label{os__dirpath_8h}\index{opal/util/os\+\_\+dirpath.\+h@{opal/util/os\+\_\+dirpath.\+h}}
}


Creates a directory tree set to the specified permissions.  


{\ttfamily \#include \char`\"{}opal\+\_\+config.\+h\char`\"{}}\\*
\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
typedef bool($\ast$ \hyperlink{os__dirpath_8h_ab2a3c3bd8e4777cd45622d773c0d62cc}{opal\+\_\+os\+\_\+dirpath\+\_\+destroy\+\_\+callback\+\_\+fn\+\_\+t} )(const char $\ast$root, const char $\ast$path)
\begin{DoxyCompactList}\small\item\em Callback for \hyperlink{os__dirpath_8h_ab2043af1e04a56cc4aa6330fd3106b56}{opal\+\_\+os\+\_\+dirpath\+\_\+destroy()}. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
B\+E\+G\+I\+N\+\_\+\+C\+\_\+\+D\+E\+C\+L\+S O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int \hyperlink{os__dirpath_8h_a0cd52e44ca3d7bbc7cd16929061a12e0}{opal\+\_\+os\+\_\+dirpath\+\_\+create} (const char $\ast$path, const mode\+\_\+t mode)
\item 
O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C bool \hyperlink{os__dirpath_8h_a75f16acf9b8ffc0e4284735737515644}{opal\+\_\+os\+\_\+dirpath\+\_\+is\+\_\+empty} (const char $\ast$path)
\begin{DoxyCompactList}\small\item\em Check to see if a directory is empty. \end{DoxyCompactList}\item 
O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int \hyperlink{os__dirpath_8h_a44b26f9f7f7ae7c6b03acf4ed409a607}{opal\+\_\+os\+\_\+dirpath\+\_\+access} (const char $\ast$path, const mode\+\_\+t mode)
\begin{DoxyCompactList}\small\item\em Check access to the directory. \end{DoxyCompactList}\item 
O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int \hyperlink{os__dirpath_8h_ab2043af1e04a56cc4aa6330fd3106b56}{opal\+\_\+os\+\_\+dirpath\+\_\+destroy} (const char $\ast$path, bool recursive, \hyperlink{os__dirpath_8h_ab2a3c3bd8e4777cd45622d773c0d62cc}{opal\+\_\+os\+\_\+dirpath\+\_\+destroy\+\_\+callback\+\_\+fn\+\_\+t} cbfunc)
\begin{DoxyCompactList}\small\item\em Destroy a directory. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Creates a directory tree set to the specified permissions. 

The \hyperlink{os__dirpath_8h_a0cd52e44ca3d7bbc7cd16929061a12e0}{opal\+\_\+os\+\_\+dirpath\+\_\+create()} function creates a directory tree, with each directory that is created in the tree having the specified access permissions. Existing directories within the tree are left untouched -\/ however, if they do not permit the user to create a directory within them, the function will return an error condition.

If the specified full path name already exists, the \hyperlink{os__dirpath_8h_a0cd52e44ca3d7bbc7cd16929061a12e0}{opal\+\_\+os\+\_\+dirpath\+\_\+create()} function will check to ensure that the final directory in the tree has at least the specified access permission. In other words, if the directory has read-\/write-\/execute for all, and the user has requested read-\/write access for just the user, then the function will consider the directory acceptable. If the minimal permissions are not currently provided, the function will attempt to change the access permissions of the directory to add the specified permissions. The function will return O\+P\+A\+L\+\_\+\+E\+R\+R\+O\+R if this cannot be done. 

\subsection{Typedef Documentation}
\hypertarget{os__dirpath_8h_ab2a3c3bd8e4777cd45622d773c0d62cc}{\index{os\+\_\+dirpath.\+h@{os\+\_\+dirpath.\+h}!opal\+\_\+os\+\_\+dirpath\+\_\+destroy\+\_\+callback\+\_\+fn\+\_\+t@{opal\+\_\+os\+\_\+dirpath\+\_\+destroy\+\_\+callback\+\_\+fn\+\_\+t}}
\index{opal\+\_\+os\+\_\+dirpath\+\_\+destroy\+\_\+callback\+\_\+fn\+\_\+t@{opal\+\_\+os\+\_\+dirpath\+\_\+destroy\+\_\+callback\+\_\+fn\+\_\+t}!os\+\_\+dirpath.\+h@{os\+\_\+dirpath.\+h}}
\subsubsection[{opal\+\_\+os\+\_\+dirpath\+\_\+destroy\+\_\+callback\+\_\+fn\+\_\+t}]{\setlength{\rightskip}{0pt plus 5cm}typedef bool($\ast$ opal\+\_\+os\+\_\+dirpath\+\_\+destroy\+\_\+callback\+\_\+fn\+\_\+t)(const char $\ast$root, const char $\ast$path)}}\label{os__dirpath_8h_ab2a3c3bd8e4777cd45622d773c0d62cc}


Callback for \hyperlink{os__dirpath_8h_ab2043af1e04a56cc4aa6330fd3106b56}{opal\+\_\+os\+\_\+dirpath\+\_\+destroy()}. 

Call for every file/directory before taking action to remove/unlink it.


\begin{DoxyParams}{Parameters}
{\em root} & A pointer to a string that contains the base path name (e.\+g., /tmp/foo from /tmp/foo/bar) \\
\hline
{\em path} & A pointer to a string that contains the file or directory (e.\+g., bar from /tmp/foo/bar)\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em true} & Allow the program to remove the file/directory \\
\hline
{\em false} & Do not allow the program to remove the file/directory \\
\hline
\end{DoxyRetVals}


\subsection{Function Documentation}
\hypertarget{os__dirpath_8h_a44b26f9f7f7ae7c6b03acf4ed409a607}{\index{os\+\_\+dirpath.\+h@{os\+\_\+dirpath.\+h}!opal\+\_\+os\+\_\+dirpath\+\_\+access@{opal\+\_\+os\+\_\+dirpath\+\_\+access}}
\index{opal\+\_\+os\+\_\+dirpath\+\_\+access@{opal\+\_\+os\+\_\+dirpath\+\_\+access}!os\+\_\+dirpath.\+h@{os\+\_\+dirpath.\+h}}
\subsubsection[{opal\+\_\+os\+\_\+dirpath\+\_\+access}]{\setlength{\rightskip}{0pt plus 5cm}O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int opal\+\_\+os\+\_\+dirpath\+\_\+access (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{path, }
\item[{const mode\+\_\+t}]{mode}
\end{DoxyParamCaption}
)}}\label{os__dirpath_8h_a44b26f9f7f7ae7c6b03acf4ed409a607}


Check access to the directory. 


\begin{DoxyParams}{Parameters}
{\em path} & A pointer to a string that contains the path name to be checked. \\
\hline
{\em mode} & A mode\+\_\+t bit mask that specifies the access permissions for the directory to be accessed.\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em O\+P\+A\+L\+\_\+\+S\+U\+C\+C\+E\+S\+S} & If directory exists, and permissions match \\
\hline
{\em O\+P\+A\+L\+\_\+\+E\+R\+R\+\_\+\+N\+O\+T\+\_\+\+F\+O\+U\+N\+D} & If directory does not exist \\
\hline
{\em O\+P\+A\+L\+\_\+\+E\+R\+R\+O\+R} & If directory exists, and permissions do not match \\
\hline
\end{DoxyRetVals}


Referenced by opal\+\_\+os\+\_\+dirpath\+\_\+destroy(), and orte\+\_\+session\+\_\+dir().

\hypertarget{os__dirpath_8h_a0cd52e44ca3d7bbc7cd16929061a12e0}{\index{os\+\_\+dirpath.\+h@{os\+\_\+dirpath.\+h}!opal\+\_\+os\+\_\+dirpath\+\_\+create@{opal\+\_\+os\+\_\+dirpath\+\_\+create}}
\index{opal\+\_\+os\+\_\+dirpath\+\_\+create@{opal\+\_\+os\+\_\+dirpath\+\_\+create}!os\+\_\+dirpath.\+h@{os\+\_\+dirpath.\+h}}
\subsubsection[{opal\+\_\+os\+\_\+dirpath\+\_\+create}]{\setlength{\rightskip}{0pt plus 5cm}B\+E\+G\+I\+N\+\_\+\+C\+\_\+\+D\+E\+C\+L\+S O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int opal\+\_\+os\+\_\+dirpath\+\_\+create (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{path, }
\item[{const mode\+\_\+t}]{mode}
\end{DoxyParamCaption}
)}}\label{os__dirpath_8h_a0cd52e44ca3d7bbc7cd16929061a12e0}

\begin{DoxyParams}{Parameters}
{\em path} & A pointer to a string that contains the path name to be built. \\
\hline
{\em mode} & A mode\+\_\+t bit mask that specifies the access permissions for the directories being constructed. \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em O\+P\+A\+L\+\_\+\+S\+U\+C\+C\+E\+S\+S} & If the directory tree has been successfully created with the specified access permissions. \\
\hline
{\em O\+P\+A\+L\+\_\+\+E\+R\+R\+O\+R} & If the directory tree could not be created with the specified access permissions. \\
\hline
\end{DoxyRetVals}


References opal\+\_\+argv\+\_\+count(), opal\+\_\+argv\+\_\+free(), opal\+\_\+argv\+\_\+split(), and opal\+\_\+output().



Referenced by orte\+\_\+iof\+\_\+base\+\_\+open().

\hypertarget{os__dirpath_8h_ab2043af1e04a56cc4aa6330fd3106b56}{\index{os\+\_\+dirpath.\+h@{os\+\_\+dirpath.\+h}!opal\+\_\+os\+\_\+dirpath\+\_\+destroy@{opal\+\_\+os\+\_\+dirpath\+\_\+destroy}}
\index{opal\+\_\+os\+\_\+dirpath\+\_\+destroy@{opal\+\_\+os\+\_\+dirpath\+\_\+destroy}!os\+\_\+dirpath.\+h@{os\+\_\+dirpath.\+h}}
\subsubsection[{opal\+\_\+os\+\_\+dirpath\+\_\+destroy}]{\setlength{\rightskip}{0pt plus 5cm}O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int opal\+\_\+os\+\_\+dirpath\+\_\+destroy (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{path, }
\item[{bool}]{recursive, }
\item[{{\bf opal\+\_\+os\+\_\+dirpath\+\_\+destroy\+\_\+callback\+\_\+fn\+\_\+t}}]{cbfunc}
\end{DoxyParamCaption}
)}}\label{os__dirpath_8h_ab2043af1e04a56cc4aa6330fd3106b56}


Destroy a directory. 


\begin{DoxyParams}{Parameters}
{\em path} & A pointer to a string that contains the path name to be destroyed \\
\hline
{\em recursive} & Recursively desend the directory removing all files and directories. if set to 'false' then the directory must be empty to succeed. \\
\hline
{\em cbfunc} & A function that will be called before removing a file or directory. If N\+U\+L\+L, then assume all remove.\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em O\+P\+A\+L\+\_\+\+S\+U\+C\+C\+E\+S\+S} & If the directory was successfully removed or removed to the specification of the user (i.\+e., obeyed the callback function). \\
\hline
{\em O\+P\+A\+L\+\_\+\+E\+R\+R\+\_\+\+N\+O\+T\+\_\+\+F\+O\+U\+N\+D} & If directory does not exist. \\
\hline
{\em O\+P\+A\+L\+\_\+\+E\+R\+R\+O\+R} & If the directory cannnot be removed, accessed properly, or contains directories that could not be removed..\\
\hline
\end{DoxyRetVals}
Destroy a directory.

If the recursive variable is non-\/zero, then it will try to recursively remove all directories. If provided, the callback function is executed prior to the directory or file being removed. If the callback returns non-\/zero, then no removal is done. 

References opal\+\_\+os\+\_\+dirpath\+\_\+access(), opal\+\_\+os\+\_\+dirpath\+\_\+is\+\_\+empty(), and opal\+\_\+os\+\_\+path().



Referenced by orte\+\_\+session\+\_\+dir\+\_\+cleanup(), and orte\+\_\+session\+\_\+dir\+\_\+finalize().

\hypertarget{os__dirpath_8h_a75f16acf9b8ffc0e4284735737515644}{\index{os\+\_\+dirpath.\+h@{os\+\_\+dirpath.\+h}!opal\+\_\+os\+\_\+dirpath\+\_\+is\+\_\+empty@{opal\+\_\+os\+\_\+dirpath\+\_\+is\+\_\+empty}}
\index{opal\+\_\+os\+\_\+dirpath\+\_\+is\+\_\+empty@{opal\+\_\+os\+\_\+dirpath\+\_\+is\+\_\+empty}!os\+\_\+dirpath.\+h@{os\+\_\+dirpath.\+h}}
\subsubsection[{opal\+\_\+os\+\_\+dirpath\+\_\+is\+\_\+empty}]{\setlength{\rightskip}{0pt plus 5cm}O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C bool opal\+\_\+os\+\_\+dirpath\+\_\+is\+\_\+empty (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{path}
\end{DoxyParamCaption}
)}}\label{os__dirpath_8h_a75f16acf9b8ffc0e4284735737515644}


Check to see if a directory is empty. 


\begin{DoxyParams}{Parameters}
{\em path} & A pointer to a string that contains the path name to be checked.\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em true} & If the directory is empty \\
\hline
{\em false} & If the directory is not empty \\
\hline
\end{DoxyRetVals}


Referenced by opal\+\_\+os\+\_\+dirpath\+\_\+destroy(), orte\+\_\+session\+\_\+dir\+\_\+cleanup(), and orte\+\_\+session\+\_\+dir\+\_\+finalize().

