/// <summary> /// Resolves the link to the true path. /// </summary> /// <param name="path">The path.</param> /// <returns></returns> /// <workitem id="19712">Uses "ls -l" to resolve links</workitem> public string ResolveLink(string path) { if (this.Device.BusyBox.Available) { var cresult = new CommandResultReceiver( ); this.Device.BusyBox.ExecuteShellCommand("readlink -f {0}", cresult, path); // if cresult is empty, return the path return((cresult == null || string.IsNullOrEmpty(cresult.Result)) ? path : cresult.Result); } else { try { // this uses the ls command to get the link path var receiver = new LinkResoverReceiver( ); Device.ExecuteShellCommand("ls {0} -l".With(path.ToArgumentSafe( )), receiver); if (!string.IsNullOrEmpty(receiver.ResolvedPath)) { return(receiver.ResolvedPath); } } catch (Exception e) { Log.d("FileSytem", e.Message); } return(path); } }
/// <summary> /// Resolves the link to the true path. /// </summary> /// <param name="path">The path.</param> /// <returns></returns> /// <workitem id="19712">Uses "ls -l" to resolve links</workitem> public string ResolveLink(string path ) { if ( this.Device.BusyBox.Available ) { var cresult = new CommandResultReceiver ( ); this.Device.BusyBox.ExecuteShellCommand ( "readlink -f {0}", cresult, path ); // if cresult is empty, return the path return ( cresult == null || string.IsNullOrEmpty ( cresult.Result ) ) ? path : cresult.Result; } else { try { // this uses the ls command to get the link path var receiver = new LinkResoverReceiver ( ); Device.ExecuteShellCommand ( "ls {0} -l".With ( path.ToArgumentSafe ( ) ), receiver ); if ( !string.IsNullOrEmpty ( receiver.ResolvedPath ) ) { return receiver.ResolvedPath; } } catch ( Exception e ) { Log.d ( "FileSytem", e.Message ); } return path; } }