1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: srciter.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_transex3.hxx"
34 #include "srciter.hxx"
36 #include <tools/fsys.hxx>
39 // class SourceTreeIterator
42 /*****************************************************************************/
43 SourceTreeIterator::SourceTreeIterator(
44 const ByteString
&rRootDirectory
, const ByteString
&rVersion
, bool bLocal_in
)
45 /*****************************************************************************/
46 : bInExecute( FALSE
) , bLocal( bLocal_in
)
51 rtl::OUString
sRootDirectory( rRootDirectory
.GetBuffer() , rRootDirectory
.Len() , RTL_TEXTENCODING_UTF8
);
52 aRootDirectory
= transex::Directory( sRootDirectory
);
56 /*****************************************************************************/
57 SourceTreeIterator::~SourceTreeIterator()
58 /*****************************************************************************/
62 /*****************************************************************************/
63 void SourceTreeIterator::ExecuteDirectory( transex::Directory
& aDirectory
)
64 /*****************************************************************************/
67 rtl::OUString sDirName
= aDirectory
.getDirectoryName();
69 static rtl::OUString
WCARD1 ( rtl::OUString::createFromAscii( "unxlng" ) );
70 static rtl::OUString
WCARD2 ( rtl::OUString::createFromAscii( "unxsol" ) );
71 static rtl::OUString
WCARD3 ( rtl::OUString::createFromAscii( "wntmsc" ) );
72 static rtl::OUString
WCARD4 ( rtl::OUString::createFromAscii( "common" ) );
73 static rtl::OUString
WCARD5 ( rtl::OUString::createFromAscii( "unxmac" ) );
74 static rtl::OUString
WCARD6 ( rtl::OUString::createFromAscii( "unxubt" ) );
75 static rtl::OUString
WCARD7 ( rtl::OUString::createFromAscii( ".svn" ) );
78 if( sDirName
.indexOf( WCARD1
, 0 ) > -1 ||
79 sDirName
.indexOf( WCARD2
, 0 ) > -1 ||
80 sDirName
.indexOf( WCARD3
, 0 ) > -1 ||
81 sDirName
.indexOf( WCARD4
, 0 ) > -1 ||
82 sDirName
.indexOf( WCARD5
, 0 ) > -1 ||
83 sDirName
.indexOf( WCARD6
, 0 ) > -1 ||
84 sDirName
.indexOf( WCARD7
, 0 ) > -1
86 //printf("**** %s \n", OUStringToOString( sDirName , RTL_TEXTENCODING_UTF8 , sDirName.getLength() ).getStr() );
88 rtl::OUString sDirNameTmp
= aDirectory
.getFullName();
89 ByteString
sDirNameTmpB( rtl::OUStringToOString( sDirNameTmp
, RTL_TEXTENCODING_UTF8
, sDirName
.getLength() ).getStr() );
92 sDirNameTmpB
.Append( ByteString("\\no_localization") );
94 sDirNameTmpB
.Append( ByteString("/no_localization") );
96 //printf("**** %s \n", OUStringToOString( sDirNameTmp , RTL_TEXTENCODING_UTF8 , sDirName.getLength() ).getStr() );
98 DirEntry
aDE( sDirNameTmpB
.GetBuffer() );
101 //printf("#### no_localization file found ... skipping");
105 aDirectory
.setSkipLinks( bSkipLinks
);
106 aDirectory
.readDirectory();
107 OnExecuteDirectory( aDirectory
.getFullName() );
108 if ( aDirectory
.getSubDirectories().size() )
109 for ( ULONG i
=0;i
< aDirectory
.getSubDirectories().size();i
++ )
110 ExecuteDirectory( aDirectory
.getSubDirectories()[ i
] );
114 /*****************************************************************************/
115 BOOL
SourceTreeIterator::StartExecute()
116 /*****************************************************************************/
119 bInExecute
= TRUE
; // FIXME
120 ExecuteDirectory( aRootDirectory
);
122 if ( bInExecute
) { // FIXME
129 /*****************************************************************************/
130 void SourceTreeIterator::EndExecute()
131 /*****************************************************************************/
136 /*****************************************************************************/
137 void SourceTreeIterator::OnExecuteDirectory( const rtl::OUString
&rDirectory
)
138 /*****************************************************************************/
140 fprintf( stdout
, "%s\n", rtl::OUStringToOString( rDirectory
, RTL_TEXTENCODING_UTF8
, rDirectory
.getLength() ).getStr() );