Discussion Board

Results 1 to 10 of 10
  1. #1
    Regular Contributor gailu's Avatar
    Join Date
    Apr 2008
    Posts
    217
    Hi Experts,

    Is it possible to create a folder in application's private path?

    I am getting KErrAccessDenied (i.e. -21) on 3rd ed FP1. So answers seems to be No but just wanted to make sure that I am not doing something wrong in my code.



    My Code
    TBuf< KMaxPath > pathWithoutDrive;
    TBuf< KMaxPath > driveAndPath;
    TBuf< 2 > appDrive;

    RFs fsSession;
    User::LeaveIfError(fsSession.Connect());
    CleanupClosePushL(fsSession);


    // Private Path Without Drive
    fsSession.PrivatePath( pathWithoutDrive );

    // Extract drive letter into appDrive:
    appDrive.Copy(Application()->AppFullName().Left(2));

    // Combine drive letter and private path
    driveAndPath.Copy(appDrive);
    driveAndPath.Append(pathWithoutDrive);
    driveAndPath.Append(_L("MyFolder"));

    BaflUtils::EnsurePathExistsL(fsSession,driveAndPath); (Error Here. I checked driveAndPath in debugger and that is OK. However drive letter is z: on emulator)

    CleanupStack::PopAndDestroy(&fsSession);
    Best Regards
    Gailu

  2. #2
    Nokia Developer Champion xhsoldier's Avatar
    Join Date
    May 2006
    Location
    Beijing,China
    Posts
    1,190
    you need to have enough capability to do that: AllFiles

    or have the certain secure ID for some certain folder.

  3. #3
    Super Contributor stichbury's Avatar
    Join Date
    Nov 2005
    Location
    London
    Posts
    584
    xhsoldier, that's not quite correct. If you call PrivatePath() you get your *own* process's private folder, and it's perfectly fine for you to write into that without AllFiles.

    The reason, I think, you're getting KErrAccessDenied, is that you're trying to write to the Z drive - aren't you? That's the ROM drive on hardware, and cannot be written to. Although you're running on emulator, behavior is the same - you'll get an error.

    If you try writing to C instead, it should be OK (though the folder has to exist.

  4. #4
    Nokia Developer Champion xhsoldier's Avatar
    Join Date
    May 2006
    Location
    Beijing,China
    Posts
    1,190
    Oh, I did not notice the PrivatePath().

    Quote Originally Posted by stichbury View Post
    xhsoldier, that's not quite correct. If you call PrivatePath() you get your *own* process's private folder, and it's perfectly fine for you to write into that without AllFiles.

    The reason, I think, you're getting KErrAccessDenied, is that you're trying to write to the Z drive - aren't you? That's the ROM drive on hardware, and cannot be written to. Although you're running on emulator, behavior is the same - you'll get an error.

    If you try writing to C instead, it should be OK (though the folder has to exist.

  5. #5
    Regular Contributor gailu's Avatar
    Join Date
    Apr 2008
    Posts
    217
    Hi Stichbury,

    Thanks for your response. Yes z: might be a problem that's the reason I highlighted that fact in Red.

    The problem is that user may install application on internal drive C: and on external memory. So instead of hardcoding drive name I followed example at
    http://wiki.forum.nokia.com/index.ph...vate_directory

    i.e.
    Application()->AppFullName().Left(2)
    Does this means that my application is installed on ROM (at least from emulator perspective)?

  6. #6
    Super Contributor stichbury's Avatar
    Join Date
    Nov 2005
    Location
    London
    Posts
    584
    Quote Originally Posted by gailu View Post
    Does this means that my application is installed on ROM (at least from emulator perspective)?
    Yes, if that's what FullName() is returning on the emulator build. I typically use #ifdef __WINS__ to write separate code that hard codes the location to C: for emulator, and then code as you were doing already for hardware builds, since you'll never be able to install to Z

  7. #7
    Nokia Developer Moderator petrib's Avatar
    Join Date
    Mar 2003
    Posts
    9,413
    On the device, if the application is installed in phone memory, it is the C-drive, and for the application, its own private subdirectory is writable.

    If the application is installed on mass memory or a memory card (E-drive), then its private subdirectory is still writable on the E-drive, and I should think it can also create and write to a corresponding private subdirectory also on C.

    The applization will not be on the Z-drive/ROM on the actual device (unless Nokia puts it there as part of the firmware), or the emulator.

  8. #8
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Mallorca, Holiday
    Posts
    27,683
    A side-note: I am not sure about Bafl::EnsurePathExistL, but generally Symbian treats the filename portion preceding the last backslash character as "directory path", and the remaining part (if any) is strictly the name of a file (not a directory). So if you encounter problems try _L("MyFolder\\").

  9. #9
    Super Contributor stichbury's Avatar
    Join Date
    Nov 2005
    Location
    London
    Posts
    584
    Quote Originally Posted by petrib View Post
    The applization will not be on the Z-drive/ROM on the actual device (unless Nokia puts it there as part of the firmware), or the emulator.
    If you put

    TFileName filename = Application()->AppFullName();

    into an application and run it on the emulator, it returns a filename which includes the Z drive. On the emulator, executables are considered to be part of ROM even if they're created by us, third party developers, and not part of Avkon or Symbian OS.

    I imagine that if you knock up a SIS file for WINSCW and 'install' to the emulator, it will 'install' to C. But for simple development purposes it's easier to assume that the drive reported by AppFullName() is bogus on emulator builds, and hard code it instead.

  10. #10
    Regular Contributor gailu's Avatar
    Join Date
    Apr 2008
    Posts
    217
    Hi Stichbury/Petrib,

    I would like to thank for explaining the details. It was really worth asking doubt and not taking assumptions (I was assuming that its not possible).

    Hi Wizard_hu,
    You are right, EnsurePathExitL does not create folder unless back slash are provided. Thanks for pointing out.


    Best Regards,
    Gailu

Similar Threads

  1. Game / Socket Issues
    By Ryushi in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2008-01-01, 17:30
  2. TextEditor with two errors
    By ahashim in forum Personal Profile
    Replies: 0
    Last Post: 2006-08-29, 23:43
  3. PC Connectity with VB6
    By mkintanar in forum PC Suite API and PC Connectivity SDK
    Replies: 5
    Last Post: 2003-09-24, 04:18
  4. what is the path to new folder in Nokia 7650
    By zikman9 in forum Symbian C++
    Replies: 0
    Last Post: 2003-08-03, 08:28
  5. Painting problem
    By guidopater in forum Mobile Java Media (Graphics & Sounds)
    Replies: 12
    Last Post: 2003-06-20, 08:53

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved