|
Lines 1658-1675
void FileProtocol::unmount( const TQString& _point )
Link Here
|
| 1658 |
|
1658 |
|
| 1659 |
bool FileProtocol::pmount(const TQString &dev) |
1659 |
bool FileProtocol::pmount(const TQString &dev) |
| 1660 |
{ |
1660 |
{ |
| 1661 |
TQString epath = getenv("PATH"); |
1661 |
TQString mountProg; |
| 1662 |
TQString path = TQString::fromLatin1("/sbin:/bin"); |
1662 |
TQCString buffer; |
| 1663 |
if (!epath.isEmpty()) |
|
|
| 1664 |
path += ":" + epath; |
| 1665 |
TQString pmountProg = TDEGlobal::dirs()->findExe("pmount", path); |
| 1666 |
|
1663 |
|
| 1667 |
if (pmountProg.isEmpty()) |
1664 |
#ifdef WITH_UDISKS2 |
| 1668 |
return false; |
1665 |
// Use 'udisksctl' (UDISKS2) if available |
|
|
1666 |
if (mountProg.isEmpty()) { |
| 1667 |
mountProg = TDEGlobal::dirs()->findExe("udisksctl"); |
| 1668 |
if (!mountProg.isEmpty()) { |
| 1669 |
buffer.sprintf( "%s mount -b %s", TQFile::encodeName(mountProg).data(), |
| 1670 |
TQFile::encodeName(TDEProcess::quote(dev)).data() ); |
| 1671 |
} |
| 1672 |
} |
| 1673 |
#endif // WITH_UDISKS2 |
| 1669 |
|
1674 |
|
| 1670 |
TQCString buffer; |
1675 |
#ifdef WITH_UDISKS |
| 1671 |
buffer.sprintf( "%s %s", TQFile::encodeName(pmountProg).data(), |
1676 |
// Use 'udisks' (UDISKS1) if available |
| 1672 |
TQFile::encodeName(TDEProcess::quote(dev)).data() ); |
1677 |
if (mountProg.isEmpty()) { |
|
|
1678 |
mountProg = TDEGlobal::dirs()->findExe("udisks"); |
| 1679 |
if (!mountProg.isEmpty()) { |
| 1680 |
buffer.sprintf( "%s --mount %s", TQFile::encodeName(mountProg).data(), |
| 1681 |
TQFile::encodeName(TDEProcess::quote(dev)).data() ); |
| 1682 |
} |
| 1683 |
} |
| 1684 |
#endif // WITH_UDISKS |
| 1685 |
|
| 1686 |
// Use 'pmount', if available |
| 1687 |
if (mountProg.isEmpty()) { |
| 1688 |
mountProg = TDEGlobal::dirs()->findExe("pmount", path); |
| 1689 |
if (!mountProg.isEmpty()) { |
| 1690 |
buffer.sprintf( "%s %s", TQFile::encodeName(mountProg).data(), |
| 1691 |
TQFile::encodeName(TDEProcess::quote(dev)).data() ); |
| 1692 |
} |
| 1693 |
} |
| 1694 |
|
| 1695 |
if (mountProg.isEmpty()) { |
| 1696 |
return false; |
| 1697 |
} |
| 1673 |
|
1698 |
|
| 1674 |
int res = system( buffer.data() ); |
1699 |
int res = system( buffer.data() ); |
| 1675 |
|
1700 |
|
|
Lines 1700-1717
bool FileProtocol::pumount(const TQString &point)
Link Here
|
| 1700 |
if (dev.isEmpty()) return false; |
1725 |
if (dev.isEmpty()) return false; |
| 1701 |
if (dev.endsWith("/")) dev.truncate(dev.length()-1); |
1726 |
if (dev.endsWith("/")) dev.truncate(dev.length()-1); |
| 1702 |
|
1727 |
|
| 1703 |
TQString epath = getenv("PATH"); |
1728 |
TQString umountProg; |
| 1704 |
TQString path = TQString::fromLatin1("/sbin:/bin"); |
1729 |
TQCString buffer; |
| 1705 |
if (!epath.isEmpty()) |
|
|
| 1706 |
path += ":" + epath; |
| 1707 |
TQString pumountProg = TDEGlobal::dirs()->findExe("pumount", path); |
| 1708 |
|
1730 |
|
| 1709 |
if (pumountProg.isEmpty()) |
1731 |
#ifdef WITH_UDISKS2 |
| 1710 |
return false; |
1732 |
// Use 'udisksctl' (UDISKS2), if available |
|
|
1733 |
if (umountProg.isEmpty()) { |
| 1734 |
umountProg = TDEGlobal::dirs()->findExe("udisksctl"); |
| 1735 |
if (!umountProg.isEmpty()) { |
| 1736 |
buffer.sprintf( "%s unmount -b %s", TQFile::encodeName(umountProg).data(), |
| 1737 |
TQFile::encodeName(TDEProcess::quote(dev)).data() ); |
| 1738 |
} |
| 1739 |
} |
| 1740 |
#endif // WITH_UDISKS2 |
| 1711 |
|
1741 |
|
| 1712 |
TQCString buffer; |
1742 |
#ifdef WITH_UDISKS |
| 1713 |
buffer.sprintf( "%s %s", TQFile::encodeName(pumountProg).data(), |
1743 |
// Use 'udisks' (UDISKS1), if available |
|
|
1744 |
if (umountProg.isEmpty()) { |
| 1745 |
umountProg = TDEGlobal::dirs()->findExe("udisks"); |
| 1746 |
if (!umountProg.isEmpty()) { |
| 1747 |
buffer.sprintf( "%s --unmount %s", TQFile::encodeName(umountProg).data(), |
| 1714 |
TQFile::encodeName(TDEProcess::quote(dev)).data() ); |
1748 |
TQFile::encodeName(TDEProcess::quote(dev)).data() ); |
|
|
1749 |
} |
| 1750 |
} |
| 1751 |
#endif // WITH_UDISKS |
| 1752 |
|
| 1753 |
// Use 'pumount', if available |
| 1754 |
if (umountProg.isEmpty()) { |
| 1755 |
umountProg = TDEGlobal::dirs()->findExe("pumount"); |
| 1756 |
if (!umountProg.isEmpty()) { |
| 1757 |
buffer.sprintf( "%s %s", TQFile::encodeName(umountProg).data(), |
| 1758 |
TQFile::encodeName(TDEProcess::quote(dev)).data() ); |
| 1759 |
} |
| 1760 |
} |
| 1761 |
|
| 1762 |
if (umountProg.isEmpty()) { |
| 1763 |
return false; |
| 1764 |
} |
| 1715 |
|
1765 |
|
| 1716 |
int res = system( buffer.data() ); |
1766 |
int res = system( buffer.data() ); |
| 1717 |
|
1767 |
|