author | ar <ar> | 2004-05-02 17:31:50 (UTC) |
---|---|---|
committer | ar <ar> | 2004-05-02 17:31:50 (UTC) |
commit | a210b9a597ba0c929d95c38ffbaf972916c7b8a7 (patch) (unidiff) | |
tree | ce121d5017eb054222c86e0afb6057a28ea7bf8a /core/symlinker/main.cpp | |
parent | 18759e9156c96795831120408a9da0d3b4ec71a4 (diff) | |
download | opie-a210b9a597ba0c929d95c38ffbaf972916c7b8a7.zip opie-a210b9a597ba0c929d95c38ffbaf972916c7b8a7.tar.gz opie-a210b9a597ba0c929d95c38ffbaf972916c7b8a7.tar.bz2 |
- convert qDebug to odebug
-rw-r--r-- | core/symlinker/main.cpp | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/core/symlinker/main.cpp b/core/symlinker/main.cpp index 6a04980..96e7f3c 100644 --- a/core/symlinker/main.cpp +++ b/core/symlinker/main.cpp | |||
@@ -1,3 +1,8 @@ | |||
1 | |||
2 | /* OPIE */ | ||
3 | #include <opie2/odebug.h> | ||
4 | |||
5 | /* QT */ | ||
1 | #include <qapplication.h> | 6 | #include <qapplication.h> |
2 | #include <qfile.h> | 7 | #include <qfile.h> |
3 | #include <qfileinfo.h> | 8 | #include <qfileinfo.h> |
@@ -5,6 +10,7 @@ | |||
5 | #include <qtextstream.h> | 10 | #include <qtextstream.h> |
6 | #include <qstringlist.h> | 11 | #include <qstringlist.h> |
7 | 12 | ||
13 | /* STD */ | ||
8 | #include <stdlib.h> | 14 | #include <stdlib.h> |
9 | #include <unistd.h> //symlink() | 15 | #include <unistd.h> //symlink() |
10 | #include <sys/stat.h> // mkdir() | 16 | #include <sys/stat.h> // mkdir() |
@@ -24,7 +30,7 @@ static void createSymlinks( const QString &location, const QString &package ) | |||
24 | 30 | ||
25 | QFile outFile( listDir + package + ".list"); | 31 | QFile outFile( listDir + package + ".list"); |
26 | 32 | ||
27 | // qDebug( "createSymlinks %s -> %s", inFile.name().ascii(), outFile.name().ascii() ); | 33 | // odebug << "createSymlinks " << inFile.name().ascii() << " -> " << outFile.name().ascii() << "" << oendl; |
28 | 34 | ||
29 | 35 | ||
30 | 36 | ||
@@ -35,21 +41,21 @@ static void createSymlinks( const QString &location, const QString &package ) | |||
35 | QString s; | 41 | QString s; |
36 | while ( !in.eof() ) { // until end of file... | 42 | while ( !in.eof() ) { // until end of file... |
37 | s = in.readLine(); // line of text excluding '\n' | 43 | s = in.readLine(); // line of text excluding '\n' |
38 | // qDebug( "Read: %s", s.ascii() ); | 44 | // odebug << "Read: " << s.ascii() << "" << oendl; |
39 | if (s.find(location,0,true) >= 0){ | 45 | if (s.find(location,0,true) >= 0){ |
40 | // qDebug( "Found!" ); | 46 | // odebug << "Found!" << oendl; |
41 | s = s.replace(location,""); | 47 | s = s.replace(location,""); |
42 | } | 48 | } |
43 | // qDebug( "Read after: %s", s.ascii() ); | 49 | // odebug << "Read after: " << s.ascii() << "" << oendl; |
44 | 50 | ||
45 | // for s, do link/mkdir. | 51 | // for s, do link/mkdir. |
46 | if ( s.right(1) == "/" ) { | 52 | if ( s.right(1) == "/" ) { |
47 | // qDebug("do mkdir for %s", s.ascii()); | 53 | // odebug << "do mkdir for " << s.ascii() << "" << oendl; |
48 | mkdir( s.ascii(), 0777 ); | 54 | mkdir( s.ascii(), 0777 ); |
49 | //possible optimization: symlink directories | 55 | //possible optimization: symlink directories |
50 | //that don't exist already. -- Risky. | 56 | //that don't exist already. -- Risky. |
51 | } else { | 57 | } else { |
52 | // qDebug("do symlink for %s", s.ascii()); | 58 | // odebug << "do symlink for " << s.ascii() << "" << oendl; |
53 | QFileInfo ffi( s ); | 59 | QFileInfo ffi( s ); |
54 | //Don't try to symlink if a regular file exists already | 60 | //Don't try to symlink if a regular file exists already |
55 | if ( !ffi.exists() || ffi.isSymLink() ) { | 61 | if ( !ffi.exists() || ffi.isSymLink() ) { |
@@ -58,16 +64,16 @@ static void createSymlinks( const QString &location, const QString &package ) | |||
58 | // perror("Symlink Failed! "); | 64 | // perror("Symlink Failed! "); |
59 | QString e=s.ascii(); | 65 | QString e=s.ascii(); |
60 | e = e.replace(ffi.fileName(),""); | 66 | e = e.replace(ffi.fileName(),""); |
61 | // qDebug("DirName : %s",e.ascii() ); | 67 | // odebug << "DirName : " << e.ascii() << "" << oendl; |
62 | system ( QString("mkdir -p ")+e.ascii() ); | 68 | system ( QString("mkdir -p ")+e.ascii() ); |
63 | if (symlink( (location+s).ascii(), s.ascii() ) != 0) | 69 | if (symlink( (location+s).ascii(), s.ascii() ) != 0) |
64 | qDebug ("Big problem creating symlink and directory"); | 70 | odebug << "Big problem creating symlink and directory" << oendl; |
65 | } | 71 | } |
66 | } | 72 | } |
67 | // qDebug ( "Created %s" ,s.ascii() ); | 73 | // qDebug ( "Created %s" ,s.ascii() ); |
68 | out << s << "\n"; | 74 | out << s << "\n"; |
69 | } else { | 75 | } else { |
70 | qDebug( "%s exists already, not symlinked", s.ascii() ); | 76 | odebug << "" << s.ascii() << " exists already, not symlinked" << oendl; |
71 | } | 77 | } |
72 | } | 78 | } |
73 | } | 79 | } |
@@ -88,14 +94,14 @@ static void removeSymlinks( const QString &package ) | |||
88 | QString s; | 94 | QString s; |
89 | while ( !in.eof() ) { // until end of file... | 95 | while ( !in.eof() ) { // until end of file... |
90 | s = in.readLine(); // line of text excluding '\n' | 96 | s = in.readLine(); // line of text excluding '\n' |
91 | // qDebug("remove symlink %s", s.ascii()); | 97 | // odebug << "remove symlink " << s.ascii() << "" << oendl; |
92 | QFileInfo ffi( s ); | 98 | QFileInfo ffi( s ); |
93 | //Confirm that it's still a symlink. | 99 | //Confirm that it's still a symlink. |
94 | if ( ffi.isSymLink() ){ | 100 | if ( ffi.isSymLink() ){ |
95 | unlink( s.ascii() ); | 101 | unlink( s.ascii() ); |
96 | // qDebug ( "Removed %s", s.ascii() );} | 102 | // qDebug ( "Removed %s", s.ascii() );} |
97 | // else | 103 | // else |
98 | // qDebug( "Not removed %s", s.ascii() ); | 104 | // odebug << "Not removed " << s.ascii() << "" << oendl; |
99 | } | 105 | } |
100 | } | 106 | } |
101 | inFile.close(); | 107 | inFile.close(); |
@@ -131,7 +137,7 @@ static void updateSymlinks() | |||
131 | 137 | ||
132 | QString info = root + "/usr/lib/ipkg/info"; | 138 | QString info = root + "/usr/lib/ipkg/info"; |
133 | QDir infoDir( info ); | 139 | QDir infoDir( info ); |
134 | // qDebug( "looking at %s", info.ascii() ); | 140 | // odebug << "looking at " << info.ascii() << "" << oendl; |
135 | if ( infoDir.isReadable() ) { | 141 | if ( infoDir.isReadable() ) { |
136 | const QFileInfoList *packages = infoDir.entryInfoList( "*.list" ); // No tr | 142 | const QFileInfoList *packages = infoDir.entryInfoList( "*.list" ); // No tr |
137 | QFileInfoListIterator it( *packages ); | 143 | QFileInfoListIterator it( *packages ); |
@@ -139,7 +145,7 @@ static void updateSymlinks() | |||
139 | while (( fi = *it )) { | 145 | while (( fi = *it )) { |
140 | ++it; | 146 | ++it; |
141 | if ( knownPackages.contains( fi->fileName() ) ) { | 147 | if ( knownPackages.contains( fi->fileName() ) ) { |
142 | // qDebug( "found %s and we've seen it before", fi->fileName().latin1() ); | 148 | // odebug << "found " << fi->fileName() << " and we've seen it before" << oendl; |
143 | knownPackages.remove( fi->fileName() ); | 149 | knownPackages.remove( fi->fileName() ); |
144 | } else { | 150 | } else { |
145 | //it's a new one | 151 | //it's a new one |
@@ -175,5 +181,5 @@ int main( int argc, char *argv[] ) | |||
175 | else if ( command == "remove" && argc > 2 ) // No tr | 181 | else if ( command == "remove" && argc > 2 ) // No tr |
176 | removeSymlinks( argv[2] ); | 182 | removeSymlinks( argv[2] ); |
177 | else | 183 | else |
178 | qWarning( "Argument error" ); | 184 | owarn << "Argument error" << oendl; |
179 | } | 185 | } |