Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 7

Qt-interest Archive, July 2007
QDir::convertSeparators doesn't work in Linux?


Message 1 in thread

Hi ALL,

I have a function:
QString PptxGen::toFullName(const QString &pureName)const
{
    QString fullName(m_path + "\\" + pureName);
    return QDir::convertSeparators(fullName);
};

I expect under Linux the separator will be converted into "/", but it 
doesn't.

Is this a bug?

Thanks,
Lingfa


--
 [ signature omitted ] 

Message 2 in thread

On 07-30-2007 3:56 PM, "Lingfa Yang" wrote:

> Hi ALL,
> 
> I have a function:
> QString PptxGen::toFullName(const QString &pureName)const
> {
>     QString fullName(m_path + "\\" + pureName);
>     return QDir::convertSeparators(fullName);
> };
> 
> I expect under Linux the separator will be converted into "/", but it
> doesn't.
> 
> Is this a bug?
> 
> Thanks,
> Lingfa

The bug is in your code. "/" is always the correct separator for internal
strings in Qt, regardless of platform. How would Linux know to convert "\\"
(Windows separator) or ":" (old Mac separator)? However, the Windows Qt code
does know how to convert "/" when necessary.

Keith
**Please do not reply to me, reply to the list.**


--
 [ signature omitted ] 

Message 3 in thread

>The bug is in your code. "/" is always the correct separator for internal
>strings in Qt, regardless of platform. How would Linux know to convert "\\"
>(Windows separator) or ":" (old Mac separator)? However, the Windows Qt code
>does know how to convert "/" when necessary.
>
>Keith
>**Please do not reply to me, reply to the list.**
>  
>
Keith,
Thanks for you answer. I'll use "/" uniformly.
Lingfa


--
 [ signature omitted ]