Код: Выделить всё
File file = ...
File path = ...
if (file.getAbsolutePath ().startsWith (path.getAbsolutePath ())
{
// overlap - file is in path
}
< /code>
Но это работает только в том случае, если мы используем один и тот же местоположение Syntax (например, полный абсолютный путь) < /p>
/home/sam/a.txtКод: Выделить всё
/home/sam/a.txtКод: Выделить всё
/home/sam/a.txtПодробнее здесь: https://stackoverflow.com/questions/797 ... -in-a-path
Мобильная версия