-rw-r--r-- | core/symlinker/main.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/symlinker/main.cpp b/core/symlinker/main.cpp index 96e7f3c..bf53a82 100644 --- a/core/symlinker/main.cpp +++ b/core/symlinker/main.cpp | |||
@@ -57,62 +57,62 @@ static void createSymlinks( const QString &location, const QString &package ) | |||
57 | } else { | 57 | } else { |
58 | // odebug << "do symlink for " << s.ascii() << "" << oendl; | 58 | // odebug << "do symlink for " << s.ascii() << "" << oendl; |
59 | QFileInfo ffi( s ); | 59 | QFileInfo ffi( s ); |
60 | //Don't try to symlink if a regular file exists already | 60 | //Don't try to symlink if a regular file exists already |
61 | if ( !ffi.exists() || ffi.isSymLink() ) { | 61 | if ( !ffi.exists() || ffi.isSymLink() ) { |
62 | if (symlink( (location+s).ascii(), s.ascii() ) != 0){ | 62 | if (symlink( (location+s).ascii(), s.ascii() ) != 0){ |
63 | if (errno == ENOENT){ | 63 | if (errno == ENOENT){ |
64 | // perror("Symlink Failed! "); | 64 | // perror("Symlink Failed! "); |
65 | QString e=s.ascii(); | 65 | QString e=s.ascii(); |
66 | e = e.replace(ffi.fileName(),""); | 66 | e = e.replace(ffi.fileName(),""); |
67 | // odebug << "DirName : " << e.ascii() << "" << oendl; | 67 | // odebug << "DirName : " << e.ascii() << "" << oendl; |
68 | system ( QString("mkdir -p ")+e.ascii() ); | 68 | system ( QString("mkdir -p ")+e.ascii() ); |
69 | if (symlink( (location+s).ascii(), s.ascii() ) != 0) | 69 | if (symlink( (location+s).ascii(), s.ascii() ) != 0) |
70 | odebug << "Big problem creating symlink and directory" << oendl; | 70 | odebug << "Big problem creating symlink and directory" << oendl; |
71 | } | 71 | } |
72 | } | 72 | } |
73 | // qDebug ( "Created %s" ,s.ascii() ); | 73 | // odebug << "Created << s.ascii() << oendl; |
74 | out << s << "\n"; | 74 | out << s << "\n"; |
75 | } else { | 75 | } else { |
76 | odebug << "" << s.ascii() << " exists already, not symlinked" << oendl; | 76 | odebug << "" << s.ascii() << " exists already, not symlinked" << oendl; |
77 | } | 77 | } |
78 | } | 78 | } |
79 | } | 79 | } |
80 | inFile.close(); | 80 | inFile.close(); |
81 | outFile.close(); | 81 | outFile.close(); |
82 | } | 82 | } |
83 | } | 83 | } |
84 | 84 | ||
85 | 85 | ||
86 | 86 | ||
87 | static void removeSymlinks( const QString &package ) | 87 | static void removeSymlinks( const QString &package ) |
88 | { | 88 | { |
89 | QFile inFile( listDir + package + ".list" ); | 89 | QFile inFile( listDir + package + ".list" ); |
90 | 90 | ||
91 | if ( inFile.open(IO_ReadOnly) ) { | 91 | if ( inFile.open(IO_ReadOnly) ) { |
92 | QTextStream in(&inFile); | 92 | QTextStream in(&inFile); |
93 | 93 | ||
94 | QString s; | 94 | QString s; |
95 | while ( !in.eof() ) { // until end of file... | 95 | while ( !in.eof() ) { // until end of file... |
96 | s = in.readLine(); // line of text excluding '\n' | 96 | s = in.readLine(); // line of text excluding '\n' |
97 | // odebug << "remove symlink " << s.ascii() << "" << oendl; | 97 | // odebug << "remove symlink " << s.ascii() << "" << oendl; |
98 | QFileInfo ffi( s ); | 98 | QFileInfo ffi( s ); |
99 | //Confirm that it's still a symlink. | 99 | //Confirm that it's still a symlink. |
100 | if ( ffi.isSymLink() ){ | 100 | if ( ffi.isSymLink() ){ |
101 | unlink( s.ascii() ); | 101 | unlink( s.ascii() ); |
102 | // qDebug ( "Removed %s", s.ascii() );} | 102 | // odebug << "Removed " << s.ascii() << oendl; } |
103 | // else | 103 | // else |
104 | // odebug << "Not removed " << s.ascii() << "" << oendl; | 104 | // odebug << "Not removed " << s.ascii() << "" << oendl; |
105 | } | 105 | } |
106 | } | 106 | } |
107 | inFile.close(); | 107 | inFile.close(); |
108 | inFile.remove(); | 108 | inFile.remove(); |
109 | } | 109 | } |
110 | } | 110 | } |
111 | 111 | ||
112 | 112 | ||
113 | 113 | ||
114 | /* | 114 | /* |
115 | Slightly hacky: we can't use StorageInfo, since we don't have a | 115 | Slightly hacky: we can't use StorageInfo, since we don't have a |
116 | QApplication. We look for filesystems that have the directory | 116 | QApplication. We look for filesystems that have the directory |
117 | /usr/lib/ipkg/info, and assume that they are removable media | 117 | /usr/lib/ipkg/info, and assume that they are removable media |
118 | with packages installed. This is safe even if eg. /usr is on a | 118 | with packages installed. This is safe even if eg. /usr is on a |