Giter VIP home page Giter VIP logo

Comments (11)

myroot avatar myroot commented on June 2, 2024

Because, you must to get from Application class object

 var dirInfo = Application.Current.DirectoryInfo;

from tizenfx.

Ben-EJ avatar Ben-EJ commented on June 2, 2024

Now get a permissions error, sorry to be a bother.

Error:
"Access to the path '/opt/media/sdcard/apps/owner/apps_rw/org.tizen.example.TimeTable/shared/data/' is denied."

Thank you for all help provided.

from tizenfx.

myroot avatar myroot commented on June 2, 2024

You need to declare privilege http://tizen.org/privilege/appdir.shareddata

https://samsung.github.io/TizenFX/master/api/Tizen.Applications.ApplicationInfo.html#Tizen_Applications_ApplicationInfo_SharedDataPath

from tizenfx.

Ben-EJ avatar Ben-EJ commented on June 2, 2024

Yeah tried defining privileges. Unfortunately they don't exist in the tizen-manifest.xml thing, tried searching for them.

Changed code to this (my create file function):

 public void createFile(String lessonToWrite, String dateOfLesson)
        {
            var dirInfo = Application.Current.DirectoryInfo;
            
            string path = dirInfo.Data;
            if (!File.Exists(path))
            {
                // Create a file to write to.
                using (StreamWriter sw = File.CreateText(path)){
                    sw.WriteLine(lessonToWrite);
                    sw.WriteLine(dateOfLesson);
                }
            }
        }

Found the permissions that will mostly likely be used for this updated code from that link you sent me. These are the permissions:
http://tizen.org/privilege/filesystem.read
http://tizen.org/privilege/filesystem.write

Cant find either in:
tizen-manifest.xml -> privileges

Any ideas?
I am trying to do this for a wearable device by the way.

from tizenfx.

Ben-EJ avatar Ben-EJ commented on June 2, 2024

Just realised the two privileges I linked are for web not .net.

Do you know of a .net alternative because I cant find one. :(

from tizenfx.

Ben-EJ avatar Ben-EJ commented on June 2, 2024

Changed the code back to:
string path = dirInfo.SharedData;

Tried using the perm that you sent me:
http://tizen.org/privilege/appdir.shareddata

Could not find it in:
tizen-manifest.xml -> privileges
When I tried to search for it so I tried adding it as a custom privilege.

I still get the error:
"Access to the path '/opt/media/sdcard/apps/owner/apps_rw/org.tizen.example.TimeTable/shared/data/' is denied."

from tizenfx.

myroot avatar myroot commented on June 2, 2024

You can edit directly tizen-manifest.xml file with text editor

    <privileges>
        <privilege>http://tizen.org/privilege/appdir.shareddata</privilege>
    </privileges>

from tizenfx.

myroot avatar myroot commented on June 2, 2024

if you use external storage you need to add this privilege http://tizen.org/privilege/externalstorage.appdata

from tizenfx.

Ben-EJ avatar Ben-EJ commented on June 2, 2024

Yeah still get the same error.

My code

<?xml version="1.0" encoding="utf-8"?>
<manifest package="org.tizen.example.TimeTable" version="1.0.0" api-version="5.5" xmlns="http://tizen.org/ns/packages">
    <profile name="wearable" />
    <ui-application appid="org.tizen.example.TimeTable" exec="TimeTable.dll" multiple="false" nodisplay="false" taskmanage="true" api-version="6" type="dotnet" launch_mode="single">
        <label>TimeTable</label>
        <icon>TimeTable.png</icon>
        <metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" />
        <splash-screens />
    </ui-application>
    <shortcut-list />
    <privileges>
        <privilege>http://tizen.org/privilege/appdir.shareddata</privilege>
		<privilege>http://tizen.org/privilege/externalstorage.appdata</privilege>
    </privileges>
    <dependencies />
    <provides-appdefined-privileges />
</manifest>

from tizenfx.

Ben-EJ avatar Ben-EJ commented on June 2, 2024

Unsure what to do

from tizenfx.

myroot avatar myroot commented on June 2, 2024

Which device you use?
please post a new issue including your current issue

from tizenfx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.