-rw-r--r-- | core/symlinker/main.cpp | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/core/symlinker/main.cpp b/core/symlinker/main.cpp index 73d5166..6a04980 100644 --- a/core/symlinker/main.cpp +++ b/core/symlinker/main.cpp | |||
@@ -13,2 +13,3 @@ | |||
13 | #include <mntent.h> | 13 | #include <mntent.h> |
14 | #include <errno.h> | ||
14 | 15 | ||
@@ -18,2 +19,3 @@ static void createSymlinks( const QString &location, const QString &package ) | |||
18 | { | 19 | { |
20 | |||
19 | QFile inFile( location + "/usr/lib/ipkg/info/" + package + ".list" ); | 21 | QFile inFile( location + "/usr/lib/ipkg/info/" + package + ".list" ); |
@@ -36,2 +38,8 @@ static void createSymlinks( const QString &location, const QString &package ) | |||
36 | //qDebug( "Read: %s", s.ascii() ); | 38 | //qDebug( "Read: %s", s.ascii() ); |
39 | if (s.find(location,0,true) >= 0){ | ||
40 | // qDebug( "Found!" ); | ||
41 | s = s.replace(location,""); | ||
42 | } | ||
43 | // qDebug( "Read after: %s", s.ascii() ); | ||
44 | |||
37 | // for s, do link/mkdir. | 45 | // for s, do link/mkdir. |
@@ -47,8 +55,18 @@ static void createSymlinks( const QString &location, const QString &package ) | |||
47 | if ( !ffi.exists() || ffi.isSymLink() ) { | 55 | if ( !ffi.exists() || ffi.isSymLink() ) { |
48 | symlink( (location+s).ascii(), s.ascii() ); | 56 | if (symlink( (location+s).ascii(), s.ascii() ) != 0){ |
57 | if (errno == ENOENT){ | ||
58 | // perror("Symlink Failed! "); | ||
59 | QString e=s.ascii(); | ||
60 | e = e.replace(ffi.fileName(),""); | ||
61 | // qDebug("DirName : %s",e.ascii() ); | ||
62 | system ( QString("mkdir -p ")+e.ascii() ); | ||
63 | if (symlink( (location+s).ascii(), s.ascii() ) != 0) | ||
64 | qDebug ("Big problem creating symlink and directory"); | ||
65 | } | ||
66 | } | ||
49 | // qDebug ( "Created %s" ,s.ascii() ); | 67 | // qDebug ( "Created %s" ,s.ascii() ); |
50 | out << s << "\n"; | 68 | out << s << "\n"; |
51 | } //else { | 69 | } else { |
52 | // qDebug( "%s exists already, not symlinked", s.ascii() ); | 70 | qDebug( "%s exists already, not symlinked", s.ascii() ); |
53 | // } | 71 | } |
54 | } | 72 | } |
@@ -75,5 +93,5 @@ static void removeSymlinks( const QString &package ) | |||
75 | //Confirm that it's still a symlink. | 93 | //Confirm that it's still a symlink. |
76 | if ( ffi.isSymLink() ) | 94 | if ( ffi.isSymLink() ){ |
77 | unlink( s.ascii() ); | 95 | unlink( s.ascii() ); |
78 | // qDebug ( "Removed %s", s.ascii() ); | 96 | // qDebug ( "Removed %s", s.ascii() );} |
79 | // else | 97 | // else |
@@ -81,2 +99,3 @@ static void removeSymlinks( const QString &package ) | |||
81 | } | 99 | } |
100 | } | ||
82 | inFile.close(); | 101 | inFile.close(); |